Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Paging Datasource fetchData

    Hi there,

    So, I know that paging a listgrid is easy and you just use dataPageSize. But, what if I want to call fetchData directly on a Datasource and I want the results to get returned to the client in pages? I have a Datasource.fetchData call that responds with too many rows for our users in one request. So, I'd like to automatically page the responses so that the fetchData possibly fetches all data over the span of several automatic paging requests and our callback logic will be able to detect when all rows have arrived. Is that possible with Datasource.fetchData? I'm guessing I'll have to add some custom logic to make it happen so any suggestions on how to do this would be helpful.

    Thanks.

    #2
    You can pass dsRequest.startRow and dsRequest.endRow as part of the requestProperties argument to dataSource.fetchData(). What the server receives is then identical to what it would receive if a ListGrid were doing paging via a ResultSet.

    However, depending on what you're trying to do, a better approach might be to create a ResultSet directly. You can trigger paged fetches by simply asking the ResultSet for a given row with resultSet.get(index), and you can use the resultSet.dataArrived() notification to detect when rows are loaded.

    Comment

    Working...
    X