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
1185
Force grid to jump to a specific row in hierarchy
posted

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!)

Parents
No Data
Reply
  • 6748
    Verified Answer
    posted

    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

     

     

Children