Using a DisplayTemplate

7 posts, 0 answers
  1. Mathias
    Mathias avatar
    34 posts
    Member since:
    Apr 2012

    Posted 26 Sep 2012 Link to this post

    Hi everyone,

    I have a grid in batch edit mode. When a cell gets in edit-mode it uses (if specified) its EditorTemplate. My question now is, if I am also able to somehow use a DisplayTemplate for the time the cells are in display-mode?

    I have a property with an UIHint on the template I wanna use. The problem is, he only uses the EditorTemplate in edit-mode, but not the DisplayTemplate in display-mode. Is there any possibility of doing this? I know that I can use the .ClientTemplate property on the columns. But I wanna use intellisense, and I need to implement a hole bunch of JavaScript-Methods.

    Hope there is a way and someone can show it to me :)

    The funny thing is: when the grid is loaded he calls the DisplayTemplate once (actually the grid needs it! Without a DisplayTemplate with the same name as the EditorTemplate nothing works!)

    best regards, Mathias
  2. michel
    michel avatar
    11 posts
    Member since:
    Apr 2013

    Posted 26 Aug 2013 Link to this post

    *bump

    We are having the same issue / question.
    Everything is working well for the EditorTemplate, but kendo doesn't seem to pick up the DisplayTemplate.
    Is there any known workaround for this problem ?

    Kind regards,
  3. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2206 posts

    Posted 29 Aug 2013 Link to this post

    Hi Mathias,

     
    Currently it's not possible to use "DisplayTemplate" for setting the display template of column in the Grid - you should use the ClientTemplate method instead. Also please note that you can call a JavaScript function using the "ClientTemplate" method in which to build the template:

    columns.Bound(m => m.Price).ClientTemplate("#=customFunction(Price)#")

    function customFunction(price) {
        var template = "";
     
        //execute your custom code to build the template and return it
     
        return template;
    }
    Kind Regards,
    Vladimir Iliev
    Telerik
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  4. Dimitrij
    Dimitrij avatar
    8 posts
    Member since:
    Apr 2015

    Posted 17 Apr 2015 Link to this post

    Is there any update on this? It's a bummer that I can't use ASP.NET MVC DisplayTemplates in a Kendo MVC Grid...

    ~ Dimitrij

  5. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2206 posts

    Posted 17 Apr 2015 Link to this post

    Hi Dimitrij,

    Please note that the DisplayTemplates are supported in server binding mode. In Ajax binding mode the items are rendered on the client so a ClientTemplate should be used instead.

    Regards,
    Vladimir Iliev
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
  6. Dekel
    Dekel avatar
    25 posts
    Member since:
    Jan 2015

    Posted 23 Jun 2015 Link to this post

    Hi,

    I do noticed that Editor Templates are supported also in Ajax. so is there any plan to enable DisplayTemplates for the kendo controls?

     

    Thanks

  7. Vladimir Iliev
    Admin
    Vladimir Iliev avatar
    2206 posts

    Posted 23 Jun 2015 Link to this post

    Hello Dekel,


    As I mention the display templates are server side markup which will work in server binding only. When the Grid use Ajax binding the editor template is bind on the client side where the server markup is already evaluated. That why if you need to render only the value without an editor you should use Kendo UI template syntax as demonstrated in the following example (the editor template is applicable for the Grid MVC wrapper as well):

    Regards,
    Vladimir Iliev
    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
Back to Top