How do you databind selected items in the ListBox Control?

1 Answer 123 Views
ListBox wrapper
Don
Top achievements
Rank 1
Don asked on 27 Sep 2022, 04:00 PM

I have been able to successfully bind a Vue ref array to the first listbox control's data-source property successfully.  I am also able to use the toolbar controls to move items back and forth between two listbox controls.  I am not able to bind a Vue ref array for selected items on the second listbox control.  I am also unable to get the "add" and "remove events to invoke my handler functions.  Please advise on how to get the selected values that are present in the second listbox control.  In the example below, how do I get "Name 2" out of the second listbox control?

 

Thank you for your help

1 Answer, 1 is accepted

Sort by
0
Accepted
Petar
Telerik team
answered on 28 Sep 2022, 10:15 AM

Hi, Don.

Here is a StackBlitz example demonstrating how we can get the values of the second Listbox control when working in a scenario similar to the one you described. 

In the example, you will also see how the add and remove events are working correctly for both the optional and selected Listboxes.

I hope the provided example will help you implement what you need in your application. Let me know if you have additional questions related to the current thread. 

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/.

Don
Top achievements
Rank 1
commented on 28 Sep 2022, 03:26 PM

Thank you so much for your timely response.  I noticed the example you provided was coded for Vue Options API.  Does the Kendo Vue Wrapper control library support Vue Composition API?  I ask because I receive the below error message when adding event handlers for Add and Remove.

Petar
Telerik team
commented on 29 Sep 2022, 12:32 PM

Hi, Don.

Here is a CodeSandbox example demonstrating how the shared above ListBox implementation can be achieved using the Vue composition API.

Please check the above example and let me know if you have questions about the suggested solution.

Don
Top achievements
Rank 1
commented on 29 Sep 2022, 03:12 PM

That's exactly what I needed.  Thank you very much.  I found my error was when I was trying to JSON.stringify() the parameter coming in on the Add/Remove events.

Thanks again.
Petar
Telerik team
commented on 29 Sep 2022, 03:37 PM

Hi, Don. 

I am happy to hear that you managed to achieve what you need in your application!

Tags
ListBox wrapper
Asked by
Don
Top achievements
Rank 1
Answers by
Petar
Telerik team
Share this question
or