kendoAutoComplete: change remote url

0 Answers 6 Views
MultiSelect
RobMarz
Top achievements
Rank 1
Iron
RobMarz asked on 25 Nov 2025, 09:02 PM

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

 

 

No answers yet. Maybe you can help?

Tags
MultiSelect
Asked by
RobMarz
Top achievements
Rank 1
Iron
Share this question
or