Unbound column with client template and ajax data source

3 posts, 0 answers
  1. Bo Chulindra
    Bo Chulindra avatar
    5 posts
    Member since:
    Dec 2013

    Posted 30 Nov 2016 Link to this post

    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. Kostadin
    Admin
    Kostadin avatar
    1733 posts

    Posted 02 Dec 2016 Link to this post

    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.
  3. Bo Chulindra
    Bo Chulindra avatar
    5 posts
    Member since:
    Dec 2013

    Posted 02 Dec 2016 in reply to Kostadin Link to this post

    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.

Back to Top