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

Kendo Grid: data-field Column Attribute not Rendered

3 Answers 447 Views
This is a migrated thread and some comments may be shown as answers.
Ryan
Top achievements
Rank 1
Ryan asked on 30 Aug 2018, 07:34 PM

I recently ran into a situation where an update method I wrote stopped working.  The method uses jQuery to open a grid row, target 4 separate fields and change their values to new ones that have come in from an API call.

When I dug in, I discovered that the attribute my method uses to navigate to each field in the row, data-field="myFieldName", was completely missing.  Thus the jQuery was finding nothing and no updates were happening.

The field is in all my other grids so I looked to see what I had done differently in this grid to make that disappear.  Turns out a couple things: One was I added "editable" and "navigatable" as options to the grid, because I'm allowing in-cell editing.  The other was I set "scrollable" to true (I typically set it to { virtual:true }).

As soon as I did this the "data-field" attribute stops being rendered in the columns.  With "editable" and "navigatable" what I get instead is an attribute "aria-describedby=" with a cell-specific GUID.  The "scrollable" property seems to just eliminate the data-field but has no other weird effects.

I need in-cell editing but I also need to have each field position identified.  Is there a way I can force "data-field" to show up?  Alternatively I could add a new "data-customAttribute" type of attr on there, but how do I accomplish that?  Worst case I can add an identifier into the actual template for the column, which is just some simple HTML. 

I'd prefer to do it with "data-field" since that would allow me to implement one consistent method for editing values whether a grid is marked as editable or not.

3 Answers, 1 is accepted

Sort by
0
Ryan
Top achievements
Rank 1
answered on 31 Aug 2018, 12:13 AM

I was able to solve it, it looks like, by adding this to my column definition:

attributes: { 'data-field': col.ColumnName }

where col is the column I'm building.

The attribute seems to get added only if it is not there, which is perfect for my needs.

0
kuku
Top achievements
Rank 1
answered on 01 Mar 2020, 03:24 AM
Did you find your answer ?
0
Plamen
Telerik team
answered on 03 Mar 2020, 01:26 PM

Hi,

Would you please elaborate the issue by providing some runnable example so we could inspect it and be more helpful? Will be looking forward to your reply.

Regards,
Plamen
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Asked by
Ryan
Top achievements
Rank 1
Answers by
Ryan
Top achievements
Rank 1
kuku
Top achievements
Rank 1
Plamen
Telerik team
Share this question
or