I'm using a multiSelect and trying to append a query string ("?str=SOMETHING") to the URL for each call to the server.
I'm writing this:
var viewModel = kendo.observable( {
attributesForMulti: new kendo.data.DataSource( {
serverFiltering: true,
transport: {
read: {
url: "/manager/ajax/attributes",
data: {
str: function() {
var element = $( "#product-important-attributes" );
var multi = element.data( "kendoMultiSelect" );
// multi.value() is undefined
return multi.value();
},
},
},
parameterMap: function( data, type ) {
if ( type === "read" ) {
return { "str": data.str() };
}
}
},
schema: {
data: function( xhr ) {
return xhr.data;
}
},
} );
} )
HTML:
<select id="product-important-attributes"
data-placeholder="-- Seleziona gli attributi"
data-role="multiselect"
data-bind="source: attributesForMulti, value: product.importantAttributes"
data-value-field="id"
data-text-field="name">
</select>The problem is that I can't get the string "color" in widget, to pass it in query string:
var multi = element.data( "kendoMultiSelect" );
multi.value();multi.value() iIt's always undefined.
This code works perfectly with "kendoAutoComplete," but I can't use it because it needs to select more than one value in the select widget.
Any ideas?
Many thanks