Reload Visible Cells


#1

Hi there,

I had a question in regards to reloading visible cells, right now i load a large amount of data, my table consists of roughly 600 to 800 cells. The problem i am facing is, when i tap on a cell, i change the cell color, and update the datastructure in the background, which is just a mutable array that hold objects of type {NSString *data , BOOL cellselected}

So if i tap on a cell, i get the gridCoord.row.index and gridCoord.column, update the respective item in the datastructure setting the cellselected value to YES, and then i reload the grid. So that it displays the correct cell color, I can imagine reloading 800 cells is not a good idea, so i just wanted to reload the visible cells.
Is there a way to do this? I read the documentation and found the function _  reloadRows:   _ when i try to use it , X-Code’s intellisense won’t recognize it, and ARC gives me an error (no visible @interface declares selector etc)

Any help on how to fix this will be greatly appreciated.

Thanks in advance.


#2

Hi,

The reload method on the ShinobiDataGrid and the ShinobiGrid will only query the datasource for the cells that are currently visible. This is what allows the grid components to render data with 1000’s of rows! 

If you are only updating a few of the rows then you are correct, reloadRows: will be a more efficient method to use. It’s a bit odd that you are seeing Xcode errors here. Have you had a look at the RenderingDynamicData sample? It shows you how to use reloadRows.

Also, as you want to just change the cell color rather than the data rendered in the cell there is an even more efficient method! You can use redrawRows to perform a light-weight re-render of the cells that have had their style changed. Again, the RenderingDynamicData sample provides an example.

Regards, Colin E.


#3

Hey thanks Colin,

i’ll try looking at the sample program and see how it works there.