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

Unbound column with client template and ajax data source

2 Answers 745 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bo Chulindra
Top achievements
Rank 1
Bo Chulindra asked on 30 Nov 2016, 10:08 PM

I have a Kendo Grid that uses Ajax. I want one of my columns to be unbound and to also use a client template. One hack is to do this:

 

columns.Template(@<text>Unused</text>).Title("SomeTitle").ClientTemplate("#=myTemplateFunction(data)#");

 

However, it is definitely a hack. Is there a better way to accomplish using a client template and have an unbound column?

2 Answers, 1 is accepted

Sort by
0
Kostadin
Telerik team
answered on 02 Dec 2016, 12:55 PM
Hi,

The approach that you are using is valid and we suggested to use it in case like yours. You can check the sample from frequently asked questions help article which uses the same approach.

I hope this information helps.

Regards,
Kostadin
Telerik by Progress
Telerik UI for ASP.NET MVC is ready for Visual Studio 2017 RC! Learn more.
0
Bo Chulindra
Top achievements
Rank 1
answered on 02 Dec 2016, 03:46 PM

Thanks for the reply. It sounds like there is no better way to accomplish this. This is a hack because the value passed to Template() is not used but it still requires a value to be passed in.

 

As a tip for anyone who needs to do this, if you are not in Razor context and there cannot do @<text></text> (for example in an extension method), you can do x => x instead.

 

I will likely create an extension method Template() that does not take a parameter. I believe that is less confusing.

Tags
Grid
Asked by
Bo Chulindra
Top achievements
Rank 1
Answers by
Kostadin
Telerik team
Bo Chulindra
Top achievements
Rank 1
Share this question
or