Load additional rows when scrolling to end of DataGrid


#1

I’m loading rows into a DataGrid from data provided by a service method on our server.  After loading and displaying the initial set of data and scrolling to the bottom of the Grid, I need to be able to request additional data from the server and append it to my current dataset.  What is the preferred way to trigger something when the last item in the list has been scrolled to and displayed?


#2

Greetings Program!

Did you find a way to do this? I would be interested to know what your solution was.

A manual solution would be to add a “Load More” button to the bottom of the grid view and when it scrolls into view, the user would click on it to trigger the request to the server.

Wg


#3

Hi,

There are a couple of ways of doing this that might work:

  1. Watch the grid’s content for offsets outside of the content size - something like this - http://stackoverflow.com/questions/2853946/uiscrollview-bounce-test. When this is detected you are at the edge of the grid so you can request your additional data and reload.
  2. Watch the data source’s method shinobiDataGrid:prepareCellForDisplay:. This method is called as cells are brought into view. By checking the cell’s grid coords against the number of rows/cols you can detect when you’ve reached the end of your loaded data. At this point you can request further data from your server and reload the grid.

I hope the above suggestions are useful! :slight_smile: