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

Clearing values from dropdowntree after setDataSource is used

3 Answers 117 Views
DropDownTree
This is a migrated thread and some comments may be shown as answers.
Roohi
Top achievements
Rank 1
Roohi asked on 04 Sep 2019, 11:52 AM

     Hi,

I have a situation where I am setting the dataSource of a dropdowntree after defining it (using the setDropDown method). Howerver, I can't seem to be able to clear values from the dropdowntree in this scenario.

I tried to replicate the problem best I could in this dojo: https://dojo.telerik.com/iKoBOVIk/3

Upon selecting item 1 and item 2, if I click the button I want the selected values to be cleared. How can I achieve this?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Ivan Danchev
Telerik team
answered on 06 Sep 2019, 06:36 AM

Hello Roohi,

This behavior is due to a known bug of the DropDownTree when using its setDataSource method. See this Github issue for more details.

Regards,
Ivan Danchev
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
Roohi
Top achievements
Rank 1
answered on 20 Sep 2019, 11:16 AM

Hi,

Just wanted to let you know that I found a fix by using the kendo HierarchicalDataSource instead of a normal array to pass into the setDataSource function.

Here's an updated version of the previous demo that uses the fix: https://dojo.telerik.com/iKoBOVIk/5

Thanks for your time!

0
Ivan Danchev
Telerik team
answered on 20 Sep 2019, 02:13 PM

Hi Roohi,

Actually even if you pass HierarchicalDataSource to the setDataSource method the issue will still be reproducible: dojo example.

The scenario would be: the DropDownTree already has a dataSource set. Some of the items are selected and then you set a new dataSource. The previously selected items are not cleared. The workaround is to clear the value before setting the new dataSource:

dropdowntree.value([]);
dropdowntree.setDataSource(test_dataSource);

 

Regards,
Ivan Danchev
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
DropDownTree
Asked by
Roohi
Top achievements
Rank 1
Answers by
Ivan Danchev
Telerik team
Roohi
Top achievements
Rank 1
Share this question
or