Server filtering not working as expected

2 posts, 0 answers
  1. Nitesh
    Nitesh avatar
    1 posts
    Member since:
    Apr 2012

    Posted 29 Mar 2013 Link to this post

    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
  2. Petur Subev
    Admin
    Petur Subev avatar
    1882 posts

    Posted 02 Apr 2013 Link to this post

    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!
  3. Kendo UI is VS 2017 Ready
Back to Top