I am using SfDataGrid in a master-detail scenario. When the user expands a row, the grid is with the child records is displayed. The details grid definition is added to the master grid upon startup using Grid.DetailsViewDefinitions.Add(NewDetailViewDef), with the NewDetailViewDef having the RelationalColumn set to a (name of the) list of objects from the parent object.
Order
Number
(other)
ItemList[]
Item
SKU
(other)
Binding of the details grid works properly. I added a selection column to the details grid, but the selection is lost when I open another master row. I need to be able to retain the row selection in the details grid in subsequent master row open/close operations, plus be able to get the selections for each of the detail grids when a "Process" button is clicked. I've been able to achieve this with a simple "global" list of objects similar to the Order class above--this class holds the key of the master and the key keys of the details grid selected items. The maintenance of the list works fine. My issue is being able to re-select the rows when the master row is opened again.
I have tried the following events:
- OrdersGrid_DetailsViewExpanded
- ItemsGrid_QueryRowStyle
- ItemsGrid_DataSourceChanged
However, none of these events provide a valid bound details grid in order to re-select the items.
Am I missing something? Is there a better, cleaner way to do this?