How to set and get items from dropdowntree
1 Answer 21 Views
Jerry
Top achievements
Rank 1
Iron
Jerry asked on 24 May 2021, 02:06 PM

I am using the kendo dropdown tree with vuejs. Below is how I am using the dropwdowntree.

The "mySelectedList" contains an array of IDs. If the form is being edited and the array is populated, this array will check items on the dropdowntree. This is as expected.

But as items from the dropdowntree are checked or unchecked by the user, this array "mySelectedList" does not get updated.

What is the proper way to bind a property to the dropdowntree?  How do I get "mySelectedList" to get updated as the user checks or unchecks items in the dropdowntree?

 

<dropdowntree 

:data-source="myDataSource"
autoClose: false
:checkboxes="true"
:check-all="true"
:placeholder="'Select from tree'"
dataTextField="text"
dataValueField="id"
v-model="mySelectedList"
>
</dropdowntree>

 

1 Answer, 1 is accepted

Sort by
0
Petar
Telerik team
answered on 27 May 2021, 11:31 AM

Hello Jerry,

The way we can get the checked items in the DropDownTree is demonstrated in this StackBlitz example. The DropDownTree is a Wrapper component and it doesn't support the binding of objects directly to the value prop as pointed in this documentation article

To get the values of the checked DropDownTree items, you can use the approach from the linked StackBlitz project or use the workaround discussed in the documentation article, also linked above. 

Check the two links and let me know if they help you implement what you need in your application.

Regards,
Petar
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/.

Asked by
Jerry
Top achievements
Rank 1
Iron
Answers by
Petar
Telerik team
Share this question
or