Add a row at a specified index in the grid

1 Answer 110 Views
Editor Grid
Balazs
Top achievements
Rank 1
Balazs asked on 05 Nov 2021, 11:47 AM | edited on 05 Nov 2021, 11:48 AM

Hi,

Is it possible to add a row at a specified index in the grid?

https://www.telerik.com/kendo-angular-ui/components/grid/editing/editing-template-forms/#toc-adding-records

In the documentation, the add row only inserts a row at the top of the grid.

I would like to achieve something similar:

If I click on the custom add button the new row editor appears at a predefined index in the grid.

Thanks,

Balazs

 

1 Answer, 1 is accepted

Sort by
1
Yanmario
Telerik team
answered on 10 Nov 2021, 08:28 AM

Hi Balazs,

Thank you for the provided screenshot.

In general, the Grid will display the items in the same order as they are in the data array that is passed to the Grid. This means that the developer can add an item at a desirable index in the data array, as demonstrated in the following demo:

https://stackblitz.com/edit/angular-2ibrqy-rpmzqp?file=app/app.component.ts

Once the new data item is added, the editRow() function can be called in order to put the newly created row in edit mode. Indeed such a custom implementation depends on the services that are used as our service and examples were created to work with the first index of the Grid when adding a new item.

I hope this helps.

Regards,
Yanmario
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
Editor Grid
Asked by
Balazs
Top achievements
Rank 1
Answers by
Yanmario
Telerik team
Share this question
or