Hi,
I have an UltraGrid that is bound to a datasource that changes in realtime. By realtime i mean that rows can be added or removed to the datasource. Supposing I have rows A,B,C,D,E,F,G,H,I. I select rows C,D with D being the active. If row I gets deleted, the selected row shifts to E and on subsequent deletes to the datasource, the selection keeps shifting down to F, G, H etc.
To re-iterate my datasource is changing from the backend, the user is not deleting.
What could this reselection be due to?
Infragistics version: 10.3
Any help would be really appreciated.
I would recommend checking what other code or events - specifically events of the grid - might be firing in your code. There's no reason why a DataTable/DataView should cause that kind of behavior. Something in your code must be altering the selection unintentionally.
Hello Huzan,
I have created a small sample trying to reproduce the described behavior. I am using an UltraGrid which is bound to a DataTable. Additionally, there are 3 buttons on the form one for inserting new rows inside the DataTable, one for deleting rows and one for showing the selected rows. On my side everything works as expected and I am able select the rows and after deleting rows or inserting new rows the selected rows remain the same (unless the user deletes a selected row, which will remove the row from the selected rows collection). Please note that this is without using the ultraGrid1.DataBind() method, if you execute it after the deletion or insertion operations it will reload the data of the grid and cause the InitializeLayout event to fire again, which would result in clearing the selected rows collection.
Attached you will find my sample for your reference. Please test it on your side and let me know how it behaves. If this is not an accurate demonstration of what you are trying to achieve, please feel free to modify it and send it back to me along with steps to reproduce. Alternatively, if the behavior cannot be replicated, please feel free to provide your own sample. Remove any external dependencies and code that is not directly related to the issue, zip your application and attach in in this case.
Having a working sample on my side, which I can debug, is going to be very helpful in finding the root cause of this behavior.
Thank you for your cooperation.
Looking forward to hearing from you.
Regards, Ivan Kitanov
GridRowsSelectionAfterDBHasBennModified.zip
It's a DataTable. I think it happens when one row gets deleted, I can see the grid.Selected.Row having another row in the collection that I have not selected. Is there a way to disable this so that selection only happens on user click and not programmatically? Or is there any other reason the grid's selection is including new rows?
It's a DataView
What's the DataSource? It sounds like your data source is doing something it shouldn't be doing. Is it a DataSet, a DataTable, an UltraDataSource, a BindingList, some custom object?