So the title pretty much says it all. I'm trying to incorporate the new MultiSelect widget into a Grid's custom popup editor template.
I'm using the Data Attribute Initialization method and reading the dropdown options from a remote dataSource. This is all working okay, but I can't get the values of the selected items into the model.
When I save the row, an array of data is sent to the server representing the first data item selected in the MultiSelect, rather than a comma-separated list of selected values.
Any ideas how I can get the MultiSelect value (list/array of selected values) into the grid model?
Thanks
Edit: I've now used a workaround, but I'd be interested to know if there's a 'proper way' to use MultiSelects with Grids.
The workaround is to add something like this to the Grid's configuration:
save: function(e) {
e.model.items = $('#select_items').data("kendoMultiSelect").value();
}
This is the relevant part of the popup editor template:
<input name="select_items" id="select_items" data-value-field="id"
data-text-field="description" data-source="itemsDataSource"
data-role="multiselect" data-auto-bind="false" data-item-template="itemList">
I've not got select_items
in the model definition: I'm using the workaround above to copy the MultiSelect's value to items
which is in the model. This seems to work, I just don't know why it is necessary.
string
is that right? – Matconsole.dir(e.model.items)
into the Grid'ssave
function. It just displays[object Object]
with no properties. I've tried addingdata.items = kendo.stringify(data.items);
into the transport.update, but that doesn't work either -- just returns"[object Object]"
. Any suggestions greatly appreciated. – Mat