Conditions to reproduce:
In this situation, in 7.0rc2, setFieldState() ought to make the detail field visible, but does not. The following patch fixes this behavior. (This has already been fixed in the nightly autobuilds.)
- A ListGrid exists which is bound to a DataSource.
- The DataSource contains a field marked detail:true.
- ListGrid.setFieldState(s) is called, with argument s equal to the return value of an earlier call to ListGrid.getFieldState().
- At the time of the getFieldState() call, the detail field is visible, due to a call to showField(). This can either happen programmatically, or through user interaction with the grid's header context menu (right-click on header -> Columns -> select detail field).
- At the time of the setFieldState() call, the detail field is not visible.
In this situation, in 7.0rc2, setFieldState() ought to make the detail field visible, but does not. The following patch fixes this behavior. (This has already been fixed in the nightly autobuilds.)
Code:
//---------------------------------------------------------------------------- // Isomorphic SmartClient 7.0rc2 patch // Purpose: Make setFieldState() show detail fields which field state argument // marks as visible // // Applies to SmartClient 7.0RC2 builds only //---------------------------------------------------------------------------- if (window.isc) { if (isc.version.startsWith("7.0rc2")) { isc.Canvas.addProperties({ $31y : function(_1, _2) { if(_1 == null) return; var _3=this.getAllFields(); var _4=_3.getProperty(this.fieldIdProperty), _5=[]; for (var i=0; i<_1.length; i++) { var _7=_1[i], _8=_3.find(this.fieldIdProperty,_7.name); if(_8 == null) { if(_7.userFormula || _7.userSummary) { _8={}; _8[this.fieldIdProperty]=_7.name; } else continue; } _4.remove(_7.name); if (_7.visible == false) _8.showIf = this.$18r; else{ _8.showIf=null; _8.detail=false; } if (_7.width != null && !isNaN(_7.width)) _8.width=_7.width; if (_7.title) _8.title=_7.title; if (_7.userFormula != null) _8.userFormula = _7.userFormula; if (_7.userSummary != null) _8.userSummary = _7.userSummary; _5.add(_8); } for (var i=0; i<_4.length; i++) { var _9=_4[i], _10=_3.findIndex(this.fieldIdProperty,_9), _8=_3[_10], _11=_3[_10-1]; if (_2) _8.showIf = this.$18r; if (_11 != null) { var _12=_5.indexOf(_11); if(_12 != -1) { _5.addAt(_8,_12+1); continue; } } if (this.fieldShouldBeVisible(_8, _10) && !_2) { _5.addAt(_8, this.$31z(_5)+1); } else _5.add(_8); } return _5; }}); } else { isc.Log.logWarn("Patch code for SmartClient version 7.0RC2 included in this application. " + "You are running version:" + isc.version + ". This patch code will have no effect " + "and can be removed."); } }