Steve - Awhile ago, you assisted me in building the grid in a fashion to always attach an extra row to the bottom of the grid. This allows for new row data entry into the grid. In testing we've come up with a way to crash the app. I've attached a sample project to illustrate this.
In order to duplicate:
Launch the app
Double Click to Edit a Cell
Scroll down in the grid, to reach rows towards the bottom.
The app will crash.
That being said, it's because in my RemoveEditor Method I have a call to gridView.UpdateData(). I use this to easily add a new row to the bottom of the grid in the event the user is editing the pre-existing blank row. This way, the user always has a blank row available to them to add data too. If I'm correct, the datasource is being updated while a cell is technically still in edit mode throwing the exception. or something like that.
I'm looking to fix this issue, I thought the best approach would be to call the gridView.UpdateData in a method along the lines of EditingCompleted but I don't have anything like that.
Do you have any thoughts, to always have the row added to the bottom, but avoid this error when scrolling down while editing a cell.
I hope this explains things well enough.
Hi,
Yes, calling gridView.UpdateData() while it's in the middle of an update, is causing the exception. What you can do though, is simply delay the update until after the current thread is done. You could do this with a begin invoke like so:
this.BeginInvokeOnMainThread (() => { gridView.UpdateData (); });
-SteveZ
Hey Steve - I've implemented this functionality in my grids and it did fix my problem, however, what I'm seeing now is complaints about editing from cell to cell. Essentially, when encapsulating the UpdateData inside the BeginInvokeOnMainThread, it causes the user to perform 4 clicks to move into editing a new cell. 2 Clicks on the new cell will take the old cell out of editing mode and 2 more clicks to get into editing of the new cell. Without the BeginInvokeOnMainThread, 2 clicks onto a new cell will automatically end editing and start editing the new cell.
Do you have any alternatives? Also, I use the UpdateData to always have a blank row at the bottom of the grid for new data entry which we've discussed in previous discussions and the BeginInvokeOnMainThread was prevent an exception when in EditMode and scrolling up in the grid.
Let me know what you think.