ComboBox Filter Not working when I use cascadeFrom

4 posts, 0 answers
  1. Chang
    Chang  avatar
    2 posts
    Member since:
    Aug 2013

    Posted 09 Jun 2014 Link to this post

    I am using a kendoComboBox to load the organization list, and I am not able to change the filter to use "contains". It always search by default using "startsWith".  
    The Kendo document shows it is very easy and straightforward to use the filter, and to add filter: "contains", should do the magic for me. But I've tried many times and it didn't work. Can you help me out?
    The difference in my example is that I use cascadeFrom, and I turn on serverFiltering.


        var organizationDropDown = $("#organization").kendoComboBox({
            autoBind: false,
            dataSource: new kendo.data.DataSource({
                serverFiltering: true,
                transport: {
                    read: {
                        url: ATSDashboardWebAPI + "api/GetOrganizations",
                        data: GetOrgType,
                        dataType: "json"
                    }
                },
                requestEnd: function(e) {
                    orgsLoaded = true;
                }
            }),
            dataTextField: "OrganizationName",
            dataValueField: "OrganizationId",
            value: SetDefaultOrganization(),
            //filter: { field: "OrganizationName", operator: "contains", value: this["#text"] },
            filter: "contains",
            cascadeFrom: "orgtype"
        }).data("kendoComboBox");
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2877 posts

    Posted 10 Jun 2014 Link to this post

    Hello Chang,

    This demo page uses cascadeFrom together with filter: "contains" and everything seems to work as expected.
    You have turned on serverFiltering which means that the DataSource will expect the server to return the filtered data (e.g. data filtering happens on the server). Could you please confirm that the server implementation filters data by a "contains" rule?

    Regards,
    Alexander Valchev
    Telerik
     
    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
  4. Chang
    Chang  avatar
    2 posts
    Member since:
    Aug 2013

    Posted 11 Jun 2014 in reply to Alexander Valchev Link to this post

    How do I implement the "contains" on the server side? There is a API call that takes input of OrganizationType and returns a list of organizations. It is using a json object and we do not have any parameter supporting for sorting in this json object. Is this the problem you pointed out?

     transport: {
                    read: {
                        url: ATSDashboardWebAPI + "api/GetOrganizations",
                        data: GetOrgType,
                        dataType: "json"
                    }
  5. Daniel
    Admin
    Daniel avatar
    2118 posts

    Posted 13 Jun 2014 Link to this post

    Hi,

    I attached a sample project that demonstrates using contains filter on the server in the described scenario.

    Regards,
    Daniel
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready