Hierarchical GDBG grid

Hi, I have a GDBG with data relation. Whenever I call grid.Refresh(), all the expanded rows will be collapsed. Is there a way to solve it? I tried to set OptimizeListChangedEvent=false and it seems that whenever I got an extra row added to the datatable, the "+/-" will be messed up. My guess is because the rowIndex has been changed, so the row state has become wacky. Also, another problem with Refresh is that if the user is modifying a cell and then the grid got refreshed, the value that the user entered will be lost. Is there any way to solve this?

3 Replies

AD Administrator Syncfusion Team June 22, 2006 05:35 PM UTC

Hi Kai, These issues happen, when the grid datasource or filter is reset. To maintain the state of row expanded / collapsed, you need to save the state and restore it after reset. Here is sample which demonstrates the way to maintain the state. Sample : ExpandGrid.zip You can call the Binder.EndEdit method to save the current cell value, before reset. Thanks and regards, Madhan


KA Kai June 23, 2006 07:52 AM UTC

I have now fixed my problem by using OptimizeListChange = true and Save the Row state (Expand/Collapse) before calling BeginUpdate and Restoring the row state after ResumeBinding. i.e. SaveState(); grid.BeginUpdate(); grid.Binder.SuspendBinding(); // do my update here grid.Binder.ResumeBinding(); RestoreState(); grid.EndUpdate(); Everything works fine EXCEPT the current cell keeps rolling down (to the number of child rows that I have on screen) whenever I have some row expanded and the dataset updated. Did I miss something? how can I preserve the CurrentCell''s position and state? Many thanks. >Hi Kai, > >These issues happen, when the grid datasource or filter is reset. To maintain the state of row expanded / collapsed, you need to save the state and restore it after reset. Here is sample which demonstrates the way to maintain the state. > >Sample : ExpandGrid.zip > >You can call the Binder.EndEdit method to save the current cell value, before reset. > >Thanks and regards, >Madhan


AD Administrator Syncfusion Team June 23, 2006 09:32 PM UTC

Hi Kai, Please try the following steps to avoid this problem. I hope this helps to sort out the issue. ++++++++++++ // Save the current cell position SaveState(); this.gridDataBoundGrid1.ShowCurrentCellBorderBehavior = GridShowCurrentCellBorder.HideAlways; grid.BeginUpdate(); grid.Binder.SuspendBinding(); // do my update here grid.Binder.ResumeBinding(); RestoreState(); this.gridDataBoundGrid1.ShowCurrentCellBorderBehavior = GridShowCurrentCellBorder.AlwaysVisible; // Restore the currentcell position grid.EndUpdate(); ++++++++++++ Best regards, Madhan

Loader.
Up arrow icon