Description
ListGrid displays a list of objects in a grid, where each row represents one object and each cell in the row represents one property.
Periodical updating ListGrid is possible in the following ways:
- Using the invalidateCache method. This approach updates the data and will show a loading message. However, this API will disrupt the existing view.
- Transparent update by DataSource using the fetchData method. This method updates the data but doesn't show a loading message and won't disrupt the existing view.
A working example is available in the attachment.
Transparent update
For transparent loading of the data the fetchData method should be used.
Update by DataSource
var dataSource = supplyItemListGrid.getDataSource(); var request = { startRow: 0, endRow: (supplyItemListGrid.getVisibleRows()[1] + supplyItemListGrid.data.resultSize), sortBy: supplyItemListGrid.getSort(), showPrompt: false }; var selectedRows = getSelectedState() var callback = function(dsResponse,data,dsRequest) { var resultSet = isc.ResultSet.create({ dataSource: supplyItemListGrid.getDataSource(), initialLength: dsResponse.totalRows, initialData: dsResponse.data, sortSpecifiers: supplyItemListGrid.getSort() }); supplyItemListGrid.setData(resultSet); supplyItemListGrid.setSelectedState(selectedRows);}; dataSource.fetchData(supplyItemListGrid.getCriteria(), callback, request);