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

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

1 Answer 363 Views
ListView (Mobile)
This is a migrated thread and some comments may be shown as answers.
Yohann
Top achievements
Rank 1
Yohann asked on 12 Apr 2014, 02:57 AM
Hello,


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 :)

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 14 Apr 2014, 07:57 AM
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:

http://docs.telerik.com/kendo-ui/getting-started/framework/templates/overview

Regards,
Kiril Nikolov
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
ListView (Mobile)
Asked by
Yohann
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or