Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

  • SmartClient 6.5.1:Patch for bug while removing all treegrid columns then adding back

    SmartClient 6.5.1 has a bug whereby one gets a Javascript error and is unable to retrieve columns in TreeGrid back after unselecting all the columns.

    This is a patch to address that issue:

    Code:
    //----------------------------------------------------------------------------
    // Isomorphic SmartClient 6.5.1 patch
    // Purpose: Fix error: Getting Javascript error and unable to retrieve columns in TreeGrid back, after unselecting the the columns 
    // 
    // Applies to SmartClient 6.5.1 builds only
    //----------------------------------------------------------------------------
    
    if (window.isc && isc.version.startsWith("6.5.1/")) {
    
    if (isc.ListGrid) {
    
    isc.ListGrid.addMethods({
    getHeaderContextMenu: function() {
        return this.ns.Menu.create({ID:this.getID()+"$314",grid:this,hide:function(){this.Super("hide",arguments);if(this.grid&&this.grid.headerMenuButton&&this.grid.headerMenuButton.isVisible()){this.grid.headerMenuButton.hide()}},doSort:function(_7,_8){this.grid.sort(_7,_8)},toggleField:function(_7,_8){var _1=this.grid,_2=_8.$35q,_3=_2?_2.data.findIndex("groupItem",true):null,_4=_2?_2.data[_3]:null,_5=(_4&&_4.fieldName==_7.fieldName);if(_7.checked){if(_1.fields.length>1){_7.checked=false;_1.hideField(_7.fieldName);if(_5)_2.setItemEnabled(_3,false)}
            if(_1.fields.length==1){for(var i=0;i<_8.data.length;i++){if(_8.data[i].checked){_8.setItemEnabled(i,false);this.$54f=i}}}}else{_7.checked=true;_1.showField(_7.fieldName);if(this.$54f!=null&&_8.data[this.$54f]){_8.setItemEnabled(this.$54f,true);this.$54f=null}
            if(_5)_2.setItemEnabled(_3,true)}},groupField:function(_7){var _1=this.grid;if((!_1.groupByField)||!_1.groupByField.contains(_7.fieldName)){_1.groupBy(_7.fieldName)}},ungroup:function(){this.grid.ungroup()}
            ,shouldEnable:function(_7,_8){
                for(var i=0;i<_7.data.length;i++){
                    if(_7.data[i].checked&&i!=_8)return true
                }
                if(_7.data[_8] && _7.data[_8].checked)return false;else return true
            }
        })
    }        
    });
    }
    
    } else if (window.isc) {
      isc.Log.logWarn("Patch for SmartClient 6.5.1 builds included in this application. " +
                "You are currently running SmartClient verion '"+ isc.version + 
                "'. This patch is not compatible with this build and will have no effect. " +
                "It should be removed from your application source.");
    }
Working...
X