My clients have just thrown a doozy at me.
I have a three level hierarchical grid. The user can right click a context menu on any row, anywhere, and go to a second page where they can edit that row, and add extra data...etc.
When they return, this is done simply by re-opening the original page, so the grid refreshes and takes in any/all updates to data that were performed.
The user now requests that the grid ALSO re-open to the same spot (band/row) it was when they opened the edit form originally. I have (server side) code that can select a row in the normal webdatagrid, but how do I extend that so a specific band is open and specific child rows are selected? the object model that drives the internals of the grid is a litle puzzling?
The grid does this itself when a postback is used to save buffered updates - so I'm hoping the behaviour can be replicated, and preferably server side, since that where I have the details on the rows to jump to.
(I'm aware of the issues of an exact match toa row not being available subsequently, and can deal with those complexities - I just need to know how to make the grid respond!)
Hello Peter,
If you want to “jump” to specific level of the grid, you should expand all the rows that lead to this level, and after this select the row by adding it to the SelectedRows collection of the Behavior for the corresponding band. Here is a sample code, that shows how to jump to the first row of the third level of the webhierarchicaldatagrid:
// expand first row
WebHierarchicalDataGrid1.GridView.Rows[0].Expanded = true;
//expand first row of the child band of the first row
WebHierarchicalDataGrid1.GridView.Rows[0].RowIslands[0].Rows[0].Expanded = true;
// take the first row on the third band
GridRecord row = WebHierarchicalDataGrid1.GridView.Rows[0].RowIslands[0].Rows[0].RowIslands[0].Rows[0];
//select the row by adding it to the SelectedRows collection of the Selection behavior of the band
WebHierarchicalDataGrid1.GridView.Rows[0].RowIslands[0].Rows[0].RowIslands[0].Behaviors.Selection.SelectedRows.Add(row);
Hope this helps.
Regards,
Lyuba Petrova
Developer Support Engineer
Infragistics
www.infragistics.com/support
Thanks, that was exactly what I needed - I'm still hazy on how the client object model hangs together for the webhierarchicalgrid.
Oh, the font used in the above post doesn't display the source code well - but the email notification I received has it all.