This is a migrated thread and some comments may be shown as answers.

rowIndex of an editable grid

1 Answer 6389 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Raziuddin
Top achievements
Rank 1
Veteran
Raziuddin asked on 29 May 2020, 08:55 AM

I have enable sorting, filtering for Kendo editable grid. When I filtering the grid, and editing any particular row, I want to get the original rowIndex (the index of the binded array) in the called function as a parameter along with the dataItem, default rowIndex values.

Note: I have attached the screenshot of my code, hope that might be helpful to understand my use case

1 Answer, 1 is accepted

Sort by
0
Accepted
Svet
Telerik team
answered on 02 Jun 2020, 06:18 AM

Hi Raziuddin,

Thank you for the provided code snippet.

I can confirm that the usage of the rowIndex of the kendoGridCellTemplate is proper. However it returns the absolute index of the current row. Thus the rowIndex for a particular row will change when the Grid data is rearranged due to sorting or filtering. What could be done in order to get the original rowIndex of the rows is to add an id property to each item that is a part of the Grid data. That will allow to keep the original rowIndex and use it at any time. If the items had an id property then the original index of each item could be captured within the kendoGridCellTemplate in the following way:

            <kendo-grid-column title="actions">
                <ng-template kendoGridCellTemplate let-dataItem let-rowIndex="rowIndex">
                    {{dataItem.id}}
                </ng-template>
            </kendo-grid-column>

Please check the provided information and let me know in case the suggested approach would help or if I am missing something. Thank you.

Regards,
Svetlin
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
Tags
Grid
Asked by
Raziuddin
Top achievements
Rank 1
Veteran
Answers by
Svet
Telerik team
Share this question
or