Announcement

Collapse
No announcement yet.
X
  • 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
    IE-11

    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?

    #2
    Hello JLivermore,

    I think the method is getTotalRows().

    Best regards,
    Blama

    Comment


      #3
      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.

      Comment


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

        ListGrid.getTotalRows()

        and

        listGrid.getRecordList().getLength()

        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.

        Comment


          #5
          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,
          Blama

          Comment


            #6
            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.

            Comment


              #7
              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.

              Comment


                #8
                ok, thanks.

                Comment

                Working...
                X