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

Set template after ListView creation

4 Answers 382 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Matthias
Top achievements
Rank 1
Matthias asked on 03 Oct 2013, 02:46 PM
Setting template as part of the constructor of a ListView works fine:

this.list = new kendo.ui.ListView(listdiv.get(0), {
                                                            dataSource: this.dataSource,
                                                            selectable: true,
                                                            template: "<div>#:label#</div>"
                                                          } );

However, changing or setting the template after the creation of the ListView does not update/set the view:

this.list.options.template = '<div>xxxx #:label#</div>';

How can I force the list to use an updated/new template?

4 Answers, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 07 Oct 2013, 07:00 AM
Hi Matthias,

Dynamically changing the template of the Kendo UI ListView is not supported. What you can do is use the destroy() method of the ListView to remove it completely and then initialize it again using the new template that you want to use.
 
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Matthias
Top achievements
Rank 1
answered on 07 Oct 2013, 12:56 PM
Can this be added as a feature request?
0
Kiril Nikolov
Telerik team
answered on 08 Oct 2013, 01:11 PM
Hello Matthias,

Of course you can suggest this as a feature request. 

Please go to our feedback forums and post it there, so it can be taken into consideration for a future release.
 
Regards,
Kiril Nikolov
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Kiril Nikolov
Telerik team
answered on 08 Oct 2013, 01:37 PM
Hi Matthias,

This functionality was added with the latest internal build, and now you can change the ListView's template with the setOptions() method. Please check the following jsBin (please keep in mind that you will need to include a reference to kendo.all.js from the latest internal build)

http://jsbin.com/uPOyUhi/2/edit
 
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
Asked by
Matthias
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Matthias
Top achievements
Rank 1
Share this question
or