Duplicated
Last Updated: 19 Apr 2022 13:29 by ADMIN
Robert
Created on: 12 Apr 2022 14:26
Category: UI for Blazor
Type: Bug Report
0
Resetting DropDownList

https://blazorrepl.telerik.com/cmYxOvaC33mi4Krl37?_ga=2.263757508.951488700.1649659216-525147323.1642084966

With an item selected, I want to reset the drop down list to the state it has when the page loads, i.e. populated with nothing selected.
Setting the backing filed to zero does not work. I have read Clear the selection, I know it works if you have a default text,
I dont't want to have a default text.

As you can see in the repl, there's some more experiments, since I thought I could maybe clear the content and re-populate
the list to reset it.
Setting the data source to null does nothing?!?!
Clearing the data source removes the items in it, but keeps the selected value!?!?

I've seen answers to this question that suggests using CSS to achieve this, but that's just stupid and shouldn't be necessary.

Finally, we have the hack solution, which is totally crazy but seems to work.
I leave it here for others to see, since it seems a lot of people also have this problem.

Please fix this.

Duplicated
This item is a duplicate of an already existing item. You can find the original item here:
2 comments
ADMIN
Dimo
Posted on: 19 Apr 2022 13:29

Hi Robert,

I agree that the DropDownList value should be easier to clear and this should work in more scenarios. Here is a similar bug report that you can follow. It is already in our short-term to-do list.

Out of curiosity, why do you prefer not to use DefaultText? This will improve our understanding of your scenario and usage pattern.

With regard to setting the Data to null - currently some of our components ignore such setups. I assume that otherwise we would need more checks in more places in our source code. Set the Data to an empty collection instead.

Regards,
Dimo
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Robert
Posted on: 12 Apr 2022 14:31
Correct REPL: REPL