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

    Live Grid actual rows in the Grid?

    SmartClient Version: v9.1p_2014-10-20/PowerEdition Deployment (built 2014-10-20)
    GWT 2.6.1

    I'm working with a ListGrid that is paged. When I return the totalRows in the DSResponse, I add another 100 for paging.

    Is there a way to get the real row count from the ListGrid? Because after the data arrives, I do a listGrid.getRecordList().getLength() and it returns the value in totalRows from the DSResponse, not the actual number of rows contained in the ListGrid?

    Hello JLivermore,

    I think the method is getTotalRows().

    Best regards,


      It's not clear what purpose you have in mind here, but you can access the ResultSet and iterate backwards from totalRows checking rowIsLoaded() to determine the last cached row.


        I was wondering if there was a convenient way to see how many rows are in the paged ListGrid at any given time.




        both return the number that is set in the DSResponse.totalRows. In my case DSResponse.totalRows is padded with extra values to maintain the paging load on demand.

        I can derive the total count by subtracting the additional page size that is added to DSResponse.totalRows on the client side and keep a total count outside the ListGrid.


          So basically your use case is:
          You have ListGrid and show data. The data can become more than known to the Grid at fetch time. If that happens you want to be able to fetch the rest data by scrolling, instead of doing invalidateCache() / refreshing? Sounds a bit like the messaging examples (#messaging_stock_quotes).

          If that's too much, a new feature issuing a new fetch for the next page when the ListGrid is scrolled down and the user hits the down-scroll-arrow would be the solution that does not need your workaround?

          Best regards,


            Hi Blama,

            My use case is to have a paged load on demand ListGrid. Out of the box everything works great. I just noticed getting the row count from the ListGrid api calls above does not give the actual number of rows in the ListGrid, it returns total number of rows + the extra 'padding' for paging that is added on the server side in the DSResponse.totalRows property (which I do manually). So I know the size of the 'padding' I add, so getting the total number of rows in the ListGrid is simply:

            ListGrid.getTotalRows() - (padding) = total rows loaded

            In the JavaDocs, ListGrid.getTotalRows() is an override point, so I could extend it with the formula above. :)

            Thank you for the pointer to ListGrid.getTotalRows()
            Last edited by JLivermore; 4 Dec 2014, 06:27.


              See post #3 for the correct way to determine the last cached row.

              You don't want to override getTotalRows() for this use case - that would only be appropriate in very, very advanced usage.


                ok, thanks.