I have a scenario where I use 2 grids, and use them frequently, and with differing numbers of rows and columns.
Between usages, I'd like to hold them in memory for quick reuse later, but I'd like to hold them with no data in them to minimize memory usage.
I can't use deleteRows because that would actually remove them from the datasource.
I'm just trying to remove all the data from the grid itself, without touching the datasource.
Is there a quick easy way to return the GridView back to its state before it had a datasource, and it had no rows or columns, but was allocated and had various behavioral properties set?
Sure, just set the dataSource of the grid to nil, and then called updateData on the grid. That will release your datasource, and the grid won't display any cells.
But if you set the datasource again and call updateData afterwards, it will display like it was working before.
Keep in mind that the grid doesn't actually hold on to the data, the datasource does. So, if you're using a DatasourceHelper you will want to remove it as well, so that its no longer keeping that data in memory.
Hope this helps,