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

How to best use multiselect for grid editing

2 Answers 313 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Dan
Top achievements
Rank 1
Dan asked on 10 Jul 2014, 06:29 PM
Hello,

We have a grid bound to a remote datasource using MVVM, and have written a custom popup editor for editing items in the grid/datasource and it's all working well.

We are in the process of extending our application to support multiselect fields. For example, let's say our datasource is employees, and the field in question is certifications. A single employee can have any number of certifications chosen from a predefined list. So, when we click edit for an employee in the grid, we'd like the popup to contain a multiselect where the user can add/remove certifications.

Our first approach was to change the server side code to return an array for the certifications field. We have since learned that the datasource object does not support arrays in fields, and that it seems to automatically convert them to a comma-delimited list. We then considered just using a delimited string instead of an array, but then are unsure how to bind this field to the multiselect widget.

We are open to whatever solution is best, but are not sure what that would be so were wondering if you'd have any advice on how to do this.

Thanks for the help,
--Dan

2 Answers, 1 is accepted

Sort by
0
Accepted
Georgi Krustev
Telerik team
answered on 11 Jul 2014, 08:32 AM
Hello Dan,

I would suggest you check this code library (or this one), which shows how to use a MultiSelect widget as an editor in grid widget. Please check it and let me if I can be of any further assistance.

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
Dan
Top achievements
Rank 1
answered on 11 Jul 2014, 04:04 PM
Thank you Georgi. This was helpful. By looking at the example we figured out we should set our field type to "object" in our datasource's model (we're not using the MVC wrappers, just js). Before it was "string", which explains why the field was being converted to a string.

Now things seem to be working better.

As an aside, support for data type "object" does not seem to be documented here:

http://docs.telerik.com/kendo-ui/api/framework/model

Thanks for the help!
Tags
MultiSelect
Asked by
Dan
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Dan
Top achievements
Rank 1
Share this question
or