I have a gridview that occupies half of an iPad screen and that's displayed over the top of a map.
As I understand it, when you assign a datasource to the grid, that triggers all the calls to build/rebuild the gridview.
I would have thought that building the grid by assigning the datasource would also have refreshed the UI to reflect the new values from the datasource.
This happens initially, when there is no gridview at all, but after the gridview is built, you can assign a new set of data to the datasource, but it doesn't seem to reflect the new information in the grid.
Anyway, I threw in a call to updateData after the assignment of the datasource, and that seemed to work.
theGridViewUI.dataSource = self;
[theGridViewUI updateData];
Am I correct in assuming that the call to updateData, is not triggering the rebuilding of the grid and calling of all the CellAt methods again?
I think it just refreshes the UI's display without building the grid, correct?
Hi David,
Are you setting the dataSource property after adding the grid to the view? Doing this will cause the grid to render itself when the view is loaded. Additionally, I added a sample to this reply to demonstrate what I asked in case you needed a reference.
Well, let me rephrase it some. I may not have been clear enough.
Yes, I am setting the datasource property after adding the gridview... but... I only add the gridview once.
After the gridview is added to the UI as a subview, I merely set the dataSource with a new set of data as needed, without re-creating the gridview.
So the FIRST time I assign the dataSource to the gridView, yes it works as expected. But any subsequent assignments of a dataSource do not trigger the gridView to refresh itself.
Does that change your answer at all?
Thanks
Dohh... Of course... Now that you put it that way it seems obvious. Don't know how i missed that. Thanks
David Baun said: Well, let me rephrase it some. I may not have been clear enough. Yes, I am setting the datasource property after adding the gridview... but... I only add the gridview once. After the gridview is added to the UI as a subview, I merely set the dataSource with a new set of data as needed, without re-creating the gridview. So the FIRST time I assign the dataSource to the gridView, yes it works as expected. But any subsequent assignments of a dataSource do not trigger the gridView to refresh itself. Does that change your answer at all? Thanks
In that case, you really wouldn't need to reassign the dataSource property, as it's already equal to what you want, which is self. Once the data you're feeding into the grid has been updated, simply call [gridView reloadData].