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

Reset ComboBox with autoBind=false

1 Answer 158 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Franz
Top achievements
Rank 1
Franz asked on 07 Mar 2014, 01:12 PM
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: http://jsbin.com/wetarafo/1/edit

Is there any way to do this?

1 Answer, 1 is accepted

Sort by
0
Kiril Nikolov
Telerik team
answered on 10 Mar 2014, 08:42 AM
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:

http://docs.telerik.com/kendo-ui/api/framework/datasource#methods-read

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:

http://docs.telerik.com/kendo-ui/api/web/combobox#methods-destroy

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
ComboBox
Asked by
Franz
Top achievements
Rank 1
Answers by
Kiril Nikolov
Telerik team
Share this question
or