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.

Periodically updating a ListGrid is possible in the following ways:

A working example is available in the attachment.

Transparent update

For transparent loading of the data theĀ fetchData method should be used.

private void onRefresh() {
    DataSource dataSource = listGrid.getDataSource();
    Criteria criteria = listGrid.getCriteria();

    Integer[] visibleRows = listGrid.getVisibleRows();
    Integer startRow = 0;
    Integer endRow = (visibleRows[1] + listGrid.getResultSet().getResultSize());

    DSRequest request = new DSRequest();
    request.setStartRow(startRow);
    request.setEndRow(endRow);
    request.setSortBy(listGrid.getSort());

    dataSource.fetchData(criteria, new DSCallback() {
        @Override
        public void execute(DSResponse response, Object rawData, DSRequest request) {
            DataSource dataSource = listGrid.getDataSource();

            ResultSet resultSet = new ResultSet(dataSource);
            resultSet.setInitialLength(response.getTotalRows());
            resultSet.setInitialData(response.getData());
            resultSet.setInitialSort(listGrid.getSort());

            listGrid.setData(resultSet);
        }

    }, request);
}

Attachments