Igniteui-angular: Igx-grid: How do i focus on the newly added row using grid.addRow()

Created on 8 Mar 2019  路  1Comment  路  Source: IgniteUI/igniteui-angular

Description

From article: https://www.infragistics.com/products/ignite-ui-angular/angular/components/grid/batch_editing.html

After adding a row to aIgx-grid, i would like to automatically focus on the first columb in the newly added grid row.

  • igniteui-angular version:
    "igniteui-angular": "7.1.9",
    "igniteui-angular-wrappers": "6.0.0",

Result

Row is added, row is not focused, grid is not scrolled to newly added row

Expected result

Row is added, focus is set to the first columb in the new row, and view/scroll changes to visualize the newly added row

batch-editing question in-review

Most helpful comment

@VirtualisProject
I've created a StackBlitz example that should cover your scenario - please have a look and let me know if works for your case.
In the example, I'm making use of the grid's onAddition emitter to scroll to the row once it's added.
Since the event only emits the data of the added row, we are not sure if the row will be into view or not (since the grid is virtualized). Hence, we need to apply custom logic to move the row into view (by scrolling the grid, changing the page or both).

Please note that there is an open issue and discussion going on about enhancing the grid's navigation API. In the future, it would likely be easier to scroll to a row/column that is out of view.

>All comments

@VirtualisProject
I've created a StackBlitz example that should cover your scenario - please have a look and let me know if works for your case.
In the example, I'm making use of the grid's onAddition emitter to scroll to the row once it's added.
Since the event only emits the data of the added row, we are not sure if the row will be into view or not (since the grid is virtualized). Hence, we need to apply custom logic to move the row into view (by scrolling the grid, changing the page or both).

Please note that there is an open issue and discussion going on about enhancing the grid's navigation API. In the future, it would likely be easier to scroll to a row/column that is out of view.

Was this page helpful?
0 / 5 - 0 ratings