Reset ComboBox with autoBind=false

2 posts, 0 answers
  1. Franz
    Franz avatar
    5 posts
    Member since:
    Aug 2011

    Posted 07 Mar 2014 Link to this post

    I have the requirement that ComboBoxes need to load their data lazily, which i did by setting the datasource to server-bound data and configure the combobox to autoBind=false. So the combobox fetches the data only when opened for the first time. However, the initially selected value is known in advance, so i create the DOM element for the combobox accordingly (meaning the <select> already has an <option> for the initially selected item).

    But: In some cases, i need to "revert" a combobox that has already fetched the data to the state before fetching, i.e. when i open the combobox after "reverting" it, it should behave like it was never opened before, which means it (re)fetches the data.

    See this jsbin for details:

    Is there any way to do this?
  2. Kiril Nikolov
    Kiril Nikolov avatar
    2598 posts

    Posted 10 Mar 2014 Link to this post

    Hello Franz,

    Thank you very much for contacting us:

    First of all I would like to inform you that the current widget configuration is not supported - you can either use local data (options elements) or remote data loaded with a dataSource. 

    If you want to restore the widget to its initial state and make it bound data again you have two options:

    1) Use the dataSource read() method, so you will read the data again from the dataSource and bind the widget with updated data from the server:

    2) If option 1 is not suitable, then you can destroy the widget using its destroy() method and recreate it again, this will reset all the changes made to the widget:

    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