I would like to turn off (and back on) the auto suggest/auto complete functionality based on user selection.
Here is the scenario:
I have an address form with the fields Suburb, State, Postcode and Country (screen shot attached)
- When the Country (kendoDropDownList) is set to “Australia” the Suburb box suggests items based on the Australia post listings (datasource is a webservice) and the State and Post Code fields are also disabled as they are populated by the AutoComplete data item.
- Now, when the user selects a country other than “Australia” I want the Suburb box to stop suggesting Australian suburbs and re-enable the State and Post Code fields.
Binding to the DropDownList’s select event is fine and re-enabling the fields works, but I can’t work out how to stop the AutoComplete box.
Any help is greatly appreciated!
Thanks
6 Answers, 1 is accepted
Did you check the enable method of the autocomplete widget? I believe it will do the work. Let me know if I am missing something.
Georgi Krustev
the Telerik team
Sorry I wasn't clear in my initial post. I would like the AutoComplete to function as a normal text box when the Country is not set to Australia. Basically, I'm after a way to turn the dropdown & suggest functionality off and then back on.
Thanks for your reply,
Matt
One possible solution is to replace the autocomplete widget with a simple input element when needed. The other option is to stop suggestion and prevent opening of the popup. Check this jsFiddle demo.
Georgi Krustev
the Telerik team
You can accomplish your goal preventing the filtering event: Check the last code snippet in the filtering event section.
Regards,
Georgi Krustev
Telerik