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

How do I deselect the DropDown list?

6 Answers 1737 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Jeremy
Top achievements
Rank 1
Jeremy asked on 17 Aug 2012, 06:04 PM
When the drop down list is first rendered, it shows that it is a drop down but has no selected value. Once you click the drop down, the available values display and it will default to the selected value. I want to provide a reset button to reset it to it's initial state of "unselected" - is there a way to do this? I tried passing values and selects to non-existent indices and it just ignores these.

6 Answers, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 20 Aug 2012, 04:06 PM
Hello Jeremy,

 
The DropDownList widget is designed to always have a selected item. In your case, I believe that the DropDownList uses load on demand binding (autoBind: false) and that is why it is empty. Once it is bound then it always will have selected item. You can use the ComboBox widget, which allows "unselected" state.

Greetings,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Atlas
Top achievements
Rank 1
answered on 23 May 2013, 12:32 AM
I am looking at your demo: http://demos.kendoui.com/web/combobox/index.html which displays a combobox that is initially not set to a value, it just displays the Placeholder text. Once you select a value, there is no way to deselect it or to go back to the initial state. How do you create an empty item to deselect a value? The combobox I am using is nullable, so you should be able to deselect once a value is selected and the only way I appear to be able to do that is to click into the combobox text and backspace it out.
This is counter intuitive.
How do I add a selectable item that reverts the value of the control to a null value?
0
Georgi Krustev
Telerik team
answered on 27 May 2013, 11:39 AM
Hello,

 
You can clear selection of the widget using value method. Check this jsBin demo for more information.

Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Atlas
Top achievements
Rank 1
answered on 28 May 2013, 04:56 PM
Thank you for your reply, but I wasn't asking how to do it programatically.
I am referring to a user hitting the web page, making a selection on the dropdown, then being able to change the selection to nothing again.
In a classic dropdown the first item in the list would be something like Please Select, and once you select a value, you can still go back and select Please Select.
I don't see a way to do that with the Kendo DropDown.
0
Atlas
Top achievements
Rank 1
answered on 28 May 2013, 05:27 PM
Sorry, I meant to post this link . The initial option is Select a Product, but once you select a product there is no way to revert back to the default.
0
Georgi Krustev
Telerik team
answered on 29 May 2013, 10:01 AM
Hello again,

 
The ComboBox widget supports only placeholder. In order to achieve your goal you will need to add such item (empty value and specific text) in the begining of the data collection.

Regards,
Georgi Krustev
Telerik
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
DropDownList
Asked by
Jeremy
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Atlas
Top achievements
Rank 1
Share this question
or