How to get the column name or index of grid from DataItem

2 Answers 988 Views
Grid RadioButton
Fraser
Top achievements
Rank 1
Fraser asked on 29 Aug 2021, 04:12 PM

I have an editor function, where I receive a dataItem parameter. I'm wondering if there's a way to retrieve the column name or index from this dataItem.

 

https://docs.telerik.com/kendo-ui/knowledge-base/radio-buttons-custom-editor

2 Answers, 1 is accepted

Sort by
0
Neli
Telerik team
answered on 01 Sep 2021, 04:00 PM

Hello Fraser,

I will need a little bit more time to review the request and provide you with more information on the issue.

I will get back to you once I have more information to share. Thank you very much for your patience.

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

0
Neli
Telerik team
answered on 02 Sep 2021, 08:54 AM

Hi Fraser,

A possible approach is to pass the column name as a parameter in the template function. 

{
           field: "CategoryID",
           width: "200px",
           title: "Category",
           template: "#=templateFunction(data, 'CategoryID')#",
           editable: function() {
           return false
     }
},

 

function templateFunction(dataItem, field) {
          var columnField = field;
         .....  
 };

Here is a Dojo example where this is demonstrated. 

I hope this helps.

Regards,
Neli
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid RadioButton
Asked by
Fraser
Top achievements
Rank 1
Answers by
Neli
Telerik team
Share this question
or