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

Smartgwt live filter Not loading data onload

$
0
0
Am using SmartGwt 2.6.0 . I have tested this is in 2 browsers
Chrome 34
Firefox 26

I have a list of objects that has to be displayed in the ListGrid. I wanted to implement the live filter to this grid, hence i have to convert my data to the Datasource. I did the conversion and loaded the data to the datasource. While rendering the grid in layout, it displays the message "No items to show". Then if i click any of the filter cells other than the first grid, the data gets retrieved and displayed. Below is the how my code looks.

'private void init(){
HLayout metaGridLay = new HLayout();
ListGrid metaListGrid = new ListGrid();


DataSourceTextField view = new DataSourceTextField("view", "View");
DataSourceTextField onlineName = new DataSourceTextField("onlineName", "Online Name");
DataSourceTextField batchName = new DataSourceTextField("batchName", "Batch Name");


dataSource.setFields(view,onlineName,batchName);
dataSource.setClientOnly(true);


metaListGrid.setShowFilterEditor(true);
metaListGrid.setFilterByCell(true);
metaListGrid.setFilterOnKeypress(true);
metaListGrid.setAlternateRecordStyles(true);
metaListGrid.setDataSource(dataSource);
metaListGrid.setAutoFetchData(true);
metaGridLay.addMember(populateGlobalMetadataLG(metaListGrid));
addMember(metaGridLay);
}


private ListGrid populateGlobalMetadataLG(final ListGrid metaListGrid) {

// I make the rpc call to get the result object

ListGridRecord[] recordGridArray = new ListGridRecord[result.size()];

int i=0;
for (GlobalMetaDataVO globalMetaDataVO : result) {

ListGridRecord record = new ListGridRecord();
record.setAttribute("view", globalMetaDataVO.getViewMetaData());
record.setAttribute("onlineName", globalMetaDataVO.getOnlineName());
record.setAttribute("batchName", globalMetaDataVO.getBatchName());
recordGridArray[i] = record;
i++;
}

dataSource.setTestData(recordGridArray);

metaListGrid.setDataSource(dataSource);
metaListGrid.redraw();

return metaListGrid;
}'

Viewing all articles
Browse latest Browse all 4756

Trending Articles