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
490
AddNew + row.ParentCollection.Move collection scrolls to the end of the grid, leaving the new row outside the visible region
posted

We want to add a new row under the selected row.

We do it (roughly) with the following code:

int index = this.Grid.Selected.Rows[0].Index;
UltraGridRow row = this.Grid.DisplayLayout.Bands[0].AddNew();
row.ParentCollection.Move(row, index + 1);

This works fine except the grid is scrolled to the end. In longer grids, the added row remains outside the visible region.

Is it possible to add a new row under the selected row and still keep the selected row and the added row within the visible region?

PS: The solution proposed here is not an option for us.

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    Hi,

    When you call AddNew, the newly-added row is scrolled into view. Since the row is always added at the bottom of the grid, the grid scrolls to the bottom.
    Then when you move the row, you are moving it out of view.
    So the simple solution is to just scroll that row back into view.

    this.Grid.ActiveRowScrollRegion.ScrollRowIntoView(row);

Children