How to display 2 different templates in the same list view ?

2 posts, 0 answers
  1. Yohann
    Yohann avatar
    54 posts
    Member since:
    Jan 2014

    Posted 11 Apr 2014 Link to this post


    When performing a search query, I return different results that do not have the same data structure and therefore, require different templates to be displayed in a list, one after another (there can be users, events, places ...).

    I'd like to know how to display 2 different templates in the same view ? can it be the same listview ? or 2 listviews one after another ? or is there a better way to do it (maybe by simply using jquery/append ?)

    What's the best way to do it ?

    Thank you very much :)
  2. Kiril Nikolov
    Kiril Nikolov avatar
    2596 posts

    Posted 14 Apr 2014 Link to this post

    Hello Yohann,

    Using different templates in the same ListView is not possible. Using jQuery to append/prepend items in the ListView is not recommended as well, if you want to this operation you need to use the built-in methods however they will still render the items using the current template.

    In general Kendo UI Templates support full JavaScript code execution inside, so you can create a conditional logic and based on the type of data that is being rendered you can execute certain part of the template. It makes the template a bit complicated, but will give you better results comparing the other approaches. You can read more about how to execute JavaScript code in a template here:

    Kiril Nikolov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top