Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

Hide/unhide columns in ListGrid internal error with FIX

$
0
0
####################################################################################################

SmartClient Version: v8.3p_2013-02-14/LGPL Development Only (built 2013-02-14)
OS: Windows 7,
Browsers Console:

Chrome 35.0.1916.153
Uncaught TypeError: undefined is not a function

FF 30.0
TypeError: fieldName.contains is not a function
var isDataPath = fieldName.contains(separator);

Use Case:
---------
1. ListGrid with 12 columns visible and 5th column (itemNumber) is the only sorting column in the Grid:
initialSort: [{property: "itemNumber", direction: "ascending"}],
2. Grid has a filter turned on: showFilterEditor:true
3. Hide all (non sorting) columns on the grid -> one visible column left (itemNumber)
4. Unhide back all not visible columns ->
a) Filter is not redrawn for all columns
b) JS error in the console

Problem:
1. ISC_Grids.js @ 28506: hiddenFieldNums.sort();
Fix:
1. ISC_Grids.js @ 28506: hiddenFieldNums.sort(function(a, b){return a-b});

####################################################################################################

################################################################################################
# alert(grid.filterEditor.getEditCol()); // 0
# grid.hideFields(fieldsToHide);
# alert(grid.filterEditor.getEditCol()); // -3
################################################################################################

Code:


    this.logWarn("hideField[2] with hiddenFieldNums: " + isc.echoFull(hiddenFieldNums) + " editCol: " + isc.echoFull(this._editColNum));

    /*
    23:40:34.257:MMV2:WARN:RecordEditor:*****ListfilterEditor:hideField[2] with hiddenFieldNums: [
    3,
    2,
    0,
    12,
    11,
    6,
    1,
    9,
    10,
    8,
    4,
    7
    ] editCol: 5
    */

    var itemsToClear = [];
    if (editorShowing) {
      hiddenFieldNums.sort();

      // http://www.w3schools.com/jsref/jsref_sort.asp
      // Default sort order is alphabetic and ascending.
      // Note: When numbers are sorted alphabetically, "40" comes before "5".
      // FIX: hiddenFieldNums.sort(function(a, b){return a-b});

      this.logWarn("hideField[3] with hiddenFieldNums: " + isc.echoFull(hiddenFieldNums) + " editCol: " + isc.echoFull(this._editColNum));
     
      /*
      23:40:34.257:MMV2:WARN:RecordEditor:*****ListfilterEditor:hideField[3] with hiddenFieldNums: [
      0,
      1,
      10,
      11,
      12,
      2,
      3,
      4,
      6,
      7,
      8,
      9
      ] editCol: 5
      */

        var form = this._editRowForm,
            items = form.getItems(),

            itemIndex = items.length-1,
            item = items[itemIndex],
            itemColNum = item.colNum,

            adjustedEditColNum = false;

        for (var i = hiddenFieldNums.length-1; i >= 0; i--) {

            var offset = i+1,
                threshold = hiddenFieldNums[i];

            if (!adjustedEditColNum && this._editColNum > threshold) {
                this._editColNum -= offset;
                adjustedEditColNum = true;
            }

            while (item != null && itemColNum >= threshold) {
                if (itemColNum == threshold) itemsToClear.add(item);
                else item.colNum -= offset;

                itemIndex --;
                item = (itemIndex >= 0) ? items[itemIndex] : null;
                itemColNum = (item != null) ? item.colNum : null;
            }
        }
    }

    this.logWarn("hideField[4] with hiddenFieldNums: " + isc.echoFull(hiddenFieldNums) + " editCol: " + isc.echoFull(this._editColNum));

    /*
    23:40:34.258:MMV2:WARN:RecordEditor:*****ListfilterEditor:hideField[4] with hiddenFieldNums: [
    0,
    1,
    10,
    11,
    12,
    2,
    3,
    4,
    6,
    7,
    8,
    9
    ] editCol: -3
    */

################################################################################################
# grid.showFields(fieldsToShow);
################################################################################################

23:40:39.205:MUP8:WARN:Canvas:_getFieldValue with dataPath: -3
23:40:39.205:MUP8:WARN:Canvas:_performActionOnValue with action: "get"
23:40:39.205:MUP8:WARN:Canvas:_performActionOnValue with field: null
23:40:39.205:MUP8:WARN:Canvas:_performActionOnValue with fieldName: -3
23:40:39.385:MUP8:WARN:Log:TypeError: undefined is not a function
Stack from error.stack:
isc.Canvas.addClassMethods._performActionOnValue() @ static/tlqTWHqYEs8LmVLW7AIuX8pEnE6Xa3e2ZzFqASE6Xyf.js:57974:32
isc.Canvas.addClassMethods._getFieldValue() @ static/tlqTWHqYEs8LmVLW7AIuX8pEnE6Xa3e2ZzFqASE6Xyf.js:58227:17
isc.ListGrid.addMethods._getEditValue() @ static/zRbecBwjEDUXViQRW5GGElXPuvPDEuhQU8HuLj3QiZA.js:41788:27
isc.ListGrid.addMethods.storeUpdatedEditorValue() @ static/zRbecBwjEDUXViQRW5GGElXPuvPDEuhQU8HuLj3QiZA.js:42907:27
isc.ListGrid.addMethods.getEditValues() @ static/zRbecBwjEDUXViQRW5GGElXPuvPDEuhQU8HuLj3QiZA.js:41037:14
isc.ListGrid.addMethods.getEditedRecord() @ static/zRbecBwjEDUXViQRW5GGElXPuvPDEuhQU8HuLj3QiZA.js:41088:44
isc.ListGrid.addMethods.showField() @ static/zRbecBwjEDUXViQRW5GGElXPuvPDEuhQU8HuLj3QiZA.js:28503:37
isc.ListGrid.addMethods.showField() @ static/zRbecBwjEDUXViQRW5GGElXPuvPDEuhQU8HuLj3QiZA.js:28584:54
isc.ListGrid.addMethods.showFields() @ static/zRbecBwjEDUXViQRW5GGElXPuvPDEuhQU8HuLj3QiZA.js:28361:17
selectAllColumns.click() @ static/qzSXWfkWuC7T3GoYkbejIJeV5IJFybXH07xS4FS3q8K.js:152:18

Viewing all articles
Browse latest Browse all 4756

Trending Articles