Grid edit mode e.container.index with Locked Column return wrong field

3 posts, 0 answers
  1. Chris
    Chris avatar
    116 posts
    Member since:
    Oct 2015

    Posted 06 Apr 2017 Link to this post

    HI

    I have found a problem about field name in edit mode.

    incell mode - edit event : 

      var grid = e.sender;
      var index = e.container.index();
      var field = grid.columns[columnIndex].field;

    without locked column, the field name is correct : 

    Click Column2 - index 1 field "Column2" <-- CORRECT

    HiddenColumn Column1 Column2
    0    1

    but with locked column, the index is wrong, because locked column always 
    place in the first of the grid.columns collection and get the wrong field :

    Click Column2 - index 1 field "HiddenColumn" <-- WRONG

    Column1(Locked) HiddenColumn Column2
    0               1 

    Is there have any solution or fixed in the newest release ?

    *Visual Studio 2015 Enterprise Update 3
    *UI for ASP.NET MVC Q2 2016(kendo\2016.2.504)

    Best regards

    Chris

     

     

     

  2. Chris
    Chris avatar
    116 posts
    Member since:
    Oct 2015

    Posted 06 Apr 2017 in reply to Chris Link to this post

    >but with locked column, the index is wrong, ...

    fix : 

    but with locked column, the field is wrong, ...

    Click Column2 - index 1 field "Column2" <-- CORRECT

    HiddenColumn Column1 Column2
    (none)    (0)   (1)


    Click Column2 - index 1 field "HiddenColumn" <-- WRONG

    Column1(Locked) HiddenColumn Column2
    (0)       (none)    1 




  3. Alex Hajigeorgieva
    Admin
    Alex Hajigeorgieva avatar
    1016 posts

    Posted 07 Apr 2017 Link to this post

    Hi Chris,

    The observed behaviour is expected because of the way that the Kendo UI Grid with locked columns is rendered. There are two tables and using the jQuery index() method returns the wrong result:

    http://docs.telerik.com/kendo-ui/controls/data-management/grid/appearance#locked-columns

    To obtain the correct field, in the same manner, you may follow the steps below:

    - check if the currently edited column is a locked one, then the original logic is correct
    - if the column is not locked, check how many locked columns there are
    - add the resulting count to the index from the call to e.container.index()

    Here is a sample implementation to get you started:
    http://dojo.telerik.com/eDemEx

    Regards,
    Alex Hajigeorgieva
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top