We made some additions to the information returned by ListGrid.getViewState() between 7.0RC1 and 7.0RC2; a side-effect of this was the introduction of a JS crash if application code calls that method on a grid that has not yet been drawn. This patch resolves that issue.
Code:
//----------------------------------------------------------------------------
// Isomorphic SmartClient 7.0rc2 patch
// Purpose: Fix JS crash when calling getViewState() on an undrawn ListGrid
//
// Applies to SmartClient 7.0RC2 builds only
//----------------------------------------------------------------------------
if (window.isc && isc.version.startsWith("7.0rc2/")) {
isc.ListGrid.addProperties({
getSpecifiedFieldWidth : function(_1) {
_1 = this.getField(_1);
var _2 = _1[this.fieldIdProperty],
_3 = this.header ? this.header.members : null,
_4 = this.frozenFields && this.frozenHeader ? this.frozenHeader.members : null,
_5;
if(_3 || _4) {
var _6 = _3.find(this.fieldIdProperty, _2);
if(!_6 && _4) {
_6 = _4.find(this.fieldIdProperty, _2);
}
if(_6 && _6.$pn && isc.isA.Number(_6.$pn)) {
_5 = _6.$pn;
}
}
return _5;
}
});
} else if (window.isc) {
isc.logWarn("Patch code included for SmartClient build version 7.0rc2. This page loads " +
"SmartClient version:" + isc.version + ". The patch code will be disabled for this build and " +
"should be removed.");
}