Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents

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.

...

Info

A working example is available in the attachment.

Transparent update

For transparent loading the data should be used fetchData method.

...

Code Block
titleHandle server response
private DSCallback createUpdateCallback() {
    return 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());

            listGrid.setData(resultSet);
        }
    };
}

Transparent update range

For transparent loading the data range should be used DSRequest. It allows you to specify a range of data to load.

Code Block
titleUpdate by DataSource
private void updateRange() {
    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);

    dataSource.fetchData(criteria, createUpdateCallback(), request);
}

Attachments

Attachments