Announcement

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

    ListGrid w/ RestDataSource: cannot get a working standalone example

    I'm trying to prepare a standalone test case in order to reproduce some problems I got with ListGrid using a RestDataSource (not client-only).
    Hence I've prepared some files that could be served by Jetty in GWT DEV mode just to simulate REST web service json responses.
    I've configured the ListGrid to use a data page size of 25 and dynamically setted the _actionUrl_ in order to request the _right fake response_ file (according to the actual needed range of records).
    The problem is: my ListGrid automatically triggers several fetches - hence consuming all data from server - while I'd like to have fetch requests triggered only when I scroll till the bottom of the ListGrid.

    I've enabled ResultSet and ListGrid logging... this chunk seems strange to me:

    13:37:29.451:XRP4:INFO:ResultSet:isc_ResultSet_0 (created by: isc_ListGrid_0):Received 25 records from server
    13:37:29.451:XRP4:DEBUG:ResultSet:isc_ResultSet_0 (created by: isc_ListGrid_0):full length set to: 100
    13:37:29.451:XRP4:DEBUG:ResultSet:isc_ResultSet_0 (created by: isc_ListGrid_0):integrating 25 rows into cache at position 0
    13:37:29.451:XRP4:INFO:ResultSet:isc_ResultSet_0 (created by: isc_ListGrid_0):cached 25 rows, from 0 to 25 (100 total rows, 25 cached)
    13:37:29.511:TMR6:DEBUG:ResultSet:isc_ResultSet_0 (created by: isc_ListGrid_0):getRange(99,100), cache check: 87,100 firstMissingRow: 87 lastMissingRow: 100
    I don't know why there some range (99,100) processing, and I suppose it triggers the fetch.
    I guess there's something wrong with my response data simulation, but I didn't get it.

    If you could please help me on fixing this code it could be useful for other forum users, except that obviously I could then proceed working on my issues.
    I'm going to attach the code and data files.

    Tried with SmartGWT 3.1 [SmartClient Version: v8.3_2012-11-20/LGPL Development Only (built 2012-11-20)]
    Browser: FireFox 10.0.11
    Attached Files

    #2
    dataPageSize, on it's own, is not enough to ensure that all dsRequest will have exact multiples of 25 as the startRow. See listGrid.drawAheadRatio, drawAllMaxCells, etc.

    Comment


      #3
      That's great, now it works and I have published it for other users

      Originally posted by Isomorphic View Post
      dataPageSize, on it's own, is not enough to ensure that all dsRequest will have exact multiples of 25 as the startRow. See listGrid.drawAheadRatio, drawAllMaxCells, etc.
      That's great, now it works!

      I previously tried setting drawAheadRatio to 0, but the problem was drawAllMaxCells. I had too little cells, hence the entire data set was pre-fetched.

      I also adapted DataSource.transformRequest () in order to request a valid file name, i.e. even if listGrid requested data from row 30 the server sends rows from 25, as per forum sumup saying
      the server can, conceivably, "reanchor" its <startRow> element, though it is hard to see what benefits this would confer. That is, the client could ask for a startRow of 7, and the server could respond with a startRow of 3.
      I have published the complete project for other users as smartgwt-listgrid-rest-test-case on github.
      Last edited by d.cavestro; 19 Dec 2012, 01:16.

      Comment

      Working...
      X