Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
785
Adding an Extra Row when in Edit Mode Exception
posted

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.

SimpleGrid.zip
Parents
No Data
Reply
  • 40030
    Offline posted

    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

Children