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

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

2 Answers 113 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Veteran
Iron
Chris asked on 06 Apr 2017, 06:08 AM

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 Answers, 1 is accepted

Sort by
0
Chris
Top achievements
Rank 1
Veteran
Iron
answered on 06 Apr 2017, 09:58 AM
>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 




0
Alex Hajigeorgieva
Telerik team
answered on 07 Apr 2017, 02:52 PM
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 (charts) and form elements.
Tags
Grid
Asked by
Chris
Top achievements
Rank 1
Veteran
Iron
Answers by
Chris
Top achievements
Rank 1
Veteran
Iron
Alex Hajigeorgieva
Telerik team
Share this question
or