I am using a DataGrid
together with a ListDataProvider
to display various row data in my application. For most cases, it was fine to fetch everything from the server at once.
Now, it appears to be necessary to fetch data on pagination steps. This means, my RPC call returns 10 items each time and the total count of possible results.
The total count is used to setup the attached SimplePager
by manually calling datagrid.setRowCount(totalCount, true)
after having set the row data. After is important here,
because setRowData also triggers a setRowCount call with the concrete number of items (always 10 in my case).
The problem is that after having set the row count manually, another participant, a ScheduledCommand
triggers a flushCommand
which in turn triggers a setRowCount
call which
sets the count back to 10. The consequence: the pager shows 1-10 of 10 and the pager controls are disabled.
How can I enforce a certain rowCount even if the ListDataProvider
only has 10 items each time?
You might suggest to use an AsyncDataProvider
. However, there already is a quite complex generic design (AbstractTablePresenter<DTO, ...>
implementing all the logic to fetch data and push it to a generic display)
which is backed by ListDataProviders. Hard to explain, but actually, I would prefer keep using the ListDataProvider
.