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

2 posts, 0 answers
  1. Aastha
    Aastha avatar
    4 posts
    Member since:
    Feb 2016

    Posted 17 Jun 2016 Link to this post


    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?

  2. Dimo
    Dimo avatar
    8458 posts

    Posted 21 Jun 2016 Link to this post

    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.

    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top