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

Locking column makes select().each() iterate twice over the selected rows

1 Answer 301 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Aastha
Top achievements
Rank 1
Aastha asked on 17 Jun 2016, 02:21 PM

Hi

I have a grid with one of the columns locked. When the user selects any of the rows I am trying to get the values from selected rows using dataitem field. It works fine if the column is not locked. But as soon as I lock a column, the select().each() function iterates over the selected rows twice which causes repeating values when I try to print them. The column that I am trying to lock is the one whose value I am trying to access using the dataitem. What is causing this behavior? Is there a way to avoid this?

1 Answer, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 21 Jun 2016, 10:53 AM
Hi Aastha,

Frozen (locked) columns require the Grid to use two separate tables for the locked data columns, and the non-locked data columns. That's why each selected row actually consists of two rows, each belonging to a separate table.

In order to prevent duplicate code execution for the same data item, you can iterate only the selected table rows, which are descendants of "div.k-grid-content-locked" or "div.k-grid-content" - whichever you prefer. These are the two div's that hold the locked and non-locked data tables.

Regards,
Dimo
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
Grid
Asked by
Aastha
Top achievements
Rank 1
Answers by
Dimo
Telerik team
Share this question
or