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

ListGrid hideField bug while not drawn (length unknown)

$
0
0
The example code to reproduce this problem:
(Paste in: http://www.smartclient.com/docs/10.0/a/system/reference/SmartClient_Explorer.html#jsonDataSource)

Code:

isc.ListGrid.create({
    ID: "countryList",
    width:500, height:224, alternateRecordStyles:true, showAllRecords:true,
    dataSource: countryDS,
    autoFetchData: true
})

countryList.hideField('countryName');

This is because the fields are not initialized yet. Why don't you simply initialize the fields in the init constructor of ListGrid like this?
Code:

if (this.completeFields == null) this.setFields(this.fields);
This ensures the fields are set and these functions can be executed.

So, this example would work:
Code:

isc.ListGrid.addMethods({
  init:function(){
      this.Super('init',arguments);
      if (this.completeFields == null) this.setFields(this.fields);
  }
});
isc.ListGrid.create({
    ID: "countryList",
    width:500, height:224, alternateRecordStyles:true, showAllRecords:true,
    dataSource: countryDS,
    autoFetchData: true
})

countryList.hideField('countryName');


Viewing all articles
Browse latest Browse all 4756

Trending Articles