Hello,
I saw a non-fatal issue in our production environment when refreshing a grouped grid with multiple summary rows. A simple null check fixed the problem. The patch is somewhat extensive. Would you consider adding this simple null check to the native code base so I don't need to maintain such an extensive patch long-term?
I saw a non-fatal issue in our production environment when refreshing a grouped grid with multiple summary rows. A simple null check fixed the problem. The patch is somewhat extensive. Would you consider adding this simple null check to the native code base so I don't need to maintain such an extensive patch long-term?
Code:
//11/21/14..$134d null check patch below
$110d:function isc_ListGrid__regroupCreateGroupTree(_1, _2, _3, _4) {
var _5 = this.createAutoChild("groupTree", {
idField: this.groupIdField,
parentIdField: this.groupParentIdField,
titleProperty: "groupValue",
childrenProperty: "groupMembers",
parentProperty: "_groupTree_" + this.ID,
showRoot: false,
isGroupedOutput: true,
alwaysSortGroupHeaders: (_2.showGroupSummary && _2.showGroupSummaryInHeader),
$684: _2.groupByField,
$141v: _2.groupByFields,
$124z: _2.groupingMode,
separateFolders: true,
$112c: "$112c",
$117k: "$117k",
$73p: _2.sortSpecifiers,
getCriteria: function() {
var _6 = this.creator.originalData;
if (_6 && _6.getCriteria) return _6.getCriteria();
return null
},
getRecordsInGroup: function(_37) {
var _7 = this.$141v,
_8 = _37.groupName,
_9 = this.getChildren(_37),
_10 = [];
if (_8 == _7[_7.length - 1]) {
if (!isc.isA.ResultSet(_9) || _9.lengthIsKnown()) {
for (var i = _9.getLength(); i--;) {
var _12 = _9.getCachedRow(i);
if (_12 != null && _12[this.$112c] !== true) {
_10.add(_12)
}
}
}
} else if (_9 != null) {
if (!isc.isA.ResultSet(_9) || _9.lengthIsKnown()) {
for (var i = 0, _13 = _9.getLength(); i < _13; ++i) {
var _12 = _9.getCachedRow(i);
if (_12 != null) {
var _14 = this.getRecordsInGroup(_12);
if (_14 != null && _14.length > 0) {
_10.addList(_14)
}
}
}
}
}
return _10
},
combineWithEditVals: function(_9) {
var _15 = this.creator,
_16 = [];
_16.addList(_9);
var _17 = _15.getAllEditRows();
if (_17.length > 0) {
var _18;
for (var i = 0; i < _16.length; i++) {
var _19 = _15.getEditSession(_16[i]);
if (_19) {
var _20 = isc.addProperties({}, _16[i], _19.$31x);
_16[i] = _20
}
}
}
return _16
},
primaryKeyFields: this.dataSource ? this.getDataSource().getPrimaryKeyFieldNames() : null,
indexOf: function(_37, _40, _41) {
var _21 = this.$27l(),
_22, _23, _24 = -1;
if (this.primaryKeyFields != null) {
var _25 = this.primaryKeyFields;
_22 = {};
for (var i = 0; i < _25.length; i++) {
var _26 = _25[i];
if (_37[_26] == null) {
_23 = false;
break
} else {
_23 = true;
_22[_26] = _37[_26]
}
}
}
if (_23) {
_24 = _21.findNextIndex(_40, _22, null, _41)
} else {
_24 = _21.indexOf(_37, _40, _41)
}
return _24
},
$110i: function(_37, _40, _41, _42) {
if (!_37) _37 = this.root;
var _27 = function(_43, i) {
if (i == null) {
i = 0
}
for (var j = 0, _13 = _43.length; j < _41 && i < _13; ++i, ++j) {
if (!this.isOpen(_43[i])) {
this.changeDataVisibility(_43[i], true)
}
}
if (i < _13) {
_27.apply(this, [_43, i])
} else {
this.changeDataVisibility(_37, true);
_40.apply(this, [])
}
};
this.$110j(_37, isc.Tree.FOLDERS_ONLY, null, _27, _41, _42)
},
$110j: function(_37, _40, _41, _42, _43, _44, _45, _46) {
var _29, _30;
if (_45 == null) {
if (!_37) _37 = this.root;
_45 = [];
if (!_41) _41 = function() {
return true
};
if (this.isLeaf(_37)) {
_42.apply(this, [_45]);
return
}
var _9 = this.getChildren(_37);
if (!_9) {
_42.apply(this, [_45]);
return
}
_29 = [_9];
_30 = [0];
_46 = {
childrenStack: _29,
indexStack: _30
}
} else {
_29 = _46.childrenStack;
_30 = _46.indexStack
}
var _31 = _29.length,
_32 = 0;
while (_31 > 0) {
var _9 = _29.pop(),
i = _30.pop();
--_31;
if (!isc.isA.ResultSet(_9) || _9.lengthIsKnown()) {
for (var _13 = _9.getLength(); i < _13; ++i, ++_32) {
if (_32 > _43) {
_29.push(_9);
_30.push(i);
this.creator[_44] = this.delayCall("$110j", [_37, _40, _41, _42, _43, _44, _45, _46], 0);
return
}
var _12 = _9.getCachedRow(i);
if (_12 != null) {
if (this.isFolder(_12)) {
if (_40 != isc.Tree.LEAVES_ONLY && _41(_12))
_45[_45.length] = _12;
var _33 = this.getChildren(_12);
if (_33) {
_29.push(_9);
_30.push(i + 1);
++_31;
_9 = _33;
i = -1;
_13 = _9.getLength()
}
} else {
if (_40 != isc.Tree.FOLDERS_ONLY && _41(_12)) {
_45[_45.length] = _12
}
}
}
}
}
}
_42.apply(this, [_45])
},
addBeforeSummaries: function(_40, _41) {
var _9 = this.getChildren(_41);
var _34 = _9 ? _9.length : null;
while (_34 > 0 && _9 && _9[_34 - 1][this.$112c]) {
_34--
}
this.add(_40, _41, _34)
},
$134d: function(_40, _41, _42) {
if (!isc.isAn.Array(_40)) _40 = [_40];
for (var i = 0; i < _40.length; i++) {
var _35 = _40[i];
//11/21/14..add null check on _35
if (_35!=null && !_35.$52e) _35 = this.getParent(_35);
if (!_35 || !_35.$52e) continue;
var _36 = this.getParents(_35);
_36.unshift(_35);
for (var j = _36.length - 2; j >= 0; j--) {
var _37 = _36[j];
if (_37.$134e == null) {
_37.$134e = true;
if (_41) {
var _38 = _36[j + 1];
if (!_38.$134f) _38.$134f = [];
_38.$134f.add(_37)
} else if (_42) {
_42.add(_37)
}
}
}
}
if (_42) return _42
},
$134g: function(_37) {
var _39 = _37.$134f;
if (!_39) return [];
delete _37.$134f;
return _39
}
}, isc.Tree);
this.logInfo("Adding " + _3.getLength() + " records to groups", "grouping");
if (_1) {
this.$1099 = this.delayCall("$110e", [_1, _2, _5, _3, 0, _3.getLength(), _4], 0)
} else {
this.$110e(_1, _2, _5, _3, 0, _3.getLength(), _4)
}
}
})