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

Show/Hide a column while loading a listGrid based on a condition

$
0
0
I want hide a column of a listgrid if a record column value doesn't meet a condition.

Columns: A, B, C
If C record value is not "1" for at least one of the last records loaded, I want hide the C column using this.hideField("C"). If at least one, I create a button in this column for the one with "1" value.

Currently I have:
Code:

...
fields: [
{name:"A"},
{name:"B"},
{name:"C",
    formatCellValue:function (value) { return '';}
},
createRecordComponent : function (record, colNum){
    var cField = this.getFieldName("colNum");
    if(cField == "C"){
          var cFieldValue = record["cField"];
          if(cFieldValue=="1"){
              var button=isc.IButton.create({...});
          }else{
              return null;
          }
    }else{
          return null;
    }
}

I am surprised to see that there is no methods to allow to hide the column after the listGrid load like onLoadComplete or fetchComplete.
I would have something like:

Code:

...
var hideCColumn = true;
this.myListGrid = isc.ListGrid.create({
...
fields: [
{name:"A"},
{name:"B"},
{name:"C",
    formatCellValue:function (value) { return '';}
},
createRecordComponent : function (record, colNum){
    var cField = this.getFieldName("colNum");
    if(cField == "C"){
          var cFieldValue = record["cField"];
          if(cFieldValue=="1"){
              hideCColumn = false;
              var button=isc.IButton.create({...});
          }else{
              return null;
          }
    }else{
          return null;
    }
},
fetchComplete: function(){  //does not exist in isomorphic
    if(hideCColumn){
          this.hideField("C");
    }
}


Do you confirm I can not do that with smartclient?

Thanks.

Viewing all articles
Browse latest Browse all 4756

Trending Articles