Set template after ListView creation

5 posts, 0 answers
  1. Matthias
    Matthias avatar
    20 posts
    Member since:
    Feb 2013

    Posted 03 Oct 2013 Link to this post

    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?
  2. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 07 Oct 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
  4. Matthias
    Matthias avatar
    20 posts
    Member since:
    Feb 2013

    Posted 07 Oct 2013 Link to this post

    Can this be added as a feature request?
  5. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 08 Oct 2013 Link to this post

    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!
  6. Kiril Nikolov
    Admin
    Kiril Nikolov avatar
    2564 posts

    Posted 08 Oct 2013 Link to this post

    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!
Back to Top
Kendo UI is VS 2017 Ready