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

ComboBox Filter Not working when I use cascadeFrom

3 Answers 927 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Chang
Top achievements
Rank 1
Chang asked on 09 Jun 2014, 04:13 PM
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");

3 Answers, 1 is accepted

Sort by
0
Alexander Valchev
Telerik team
answered on 10 Jun 2014, 07:01 AM
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!
 
0
Chang
Top achievements
Rank 1
answered on 11 Jun 2014, 10:00 PM
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"
                }
0
Daniel
Telerik team
answered on 13 Jun 2014, 04:18 PM
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!
 
Tags
ComboBox
Asked by
Chang
Top achievements
Rank 1
Answers by
Alexander Valchev
Telerik team
Chang
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or