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

Server filtering not working as expected

1 Answer 629 Views
MultiSelect
This is a migrated thread and some comments may be shown as answers.
Nitesh
Top achievements
Rank 1
Nitesh asked on 29 Mar 2013, 12:50 PM
Hi,

I am using the new multiselect widget with server filtering enabled.  The issue that I am facing is that I am not able to retrieve the entered text (using the javascript function onAdditionalData) and send it to the server side for filtering.  Please see example below:

$("#merchants").kendoMultiSelect({
                dataSource: {
                    transport: {
                        prefix: "",
                        read: {
                            url: "GetMerchants",
                            data: onAdditionalData
                        }
                    },
                    serverFiltering: true,
                    filter: [],
                    schema: { "errors": "Errors" },
                    
                },
                placeholder: "Select merchants...",
                dataTextField: "Name",
                dataValueField: "Id",
                filter: 'contains'
                
            });

function onAdditionalData() {

            return {
                text: $("#merchants").value()
            };
        }

Thanks,
Nitesh

1 Answer, 1 is accepted

Sort by
0
Petur Subev
Telerik team
answered on 02 Apr 2013, 08:06 AM
Hello Nitesh,

To get the value of the MultiSelect you could use the following approach:

e.g.

$(document).ready(function () {
           $("#products").kendoMultiSelect({
               placeholder: "Select products...",
               dataTextField: "ProductName",
               dataValueField: "ProductID",
               dataSource: {
                   type: "odata",
                   serverFiltering: true,
                   transport: {
                       read: {
                           url: "http://demos.kendoui.com/service/Northwind.svc/Products",
                           data: function () {                               
                               return {
                                   text: $("#products").data('kendoMultiSelect').input.val()
                               };
                           }
                       }
                   }
               }
           });
       });


All the best,
Petur Subev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
MultiSelect
Asked by
Nitesh
Top achievements
Rank 1
Answers by
Petur Subev
Telerik team
Share this question
or