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

Cascade & json?

1 Answer 150 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
David OBrien
Top achievements
Rank 1
David OBrien asked on 15 Aug 2012, 05:36 PM
I have 4 cascading combos

$("#LineOfBusiness").kendoComboBox({
    dataTextField: "LineOfBusiness",
    dataValueField: "LineOfBusiness",
    dataSource: {
        type: "json",                           
        transport: {
            read: "/ajax/lobs.php"
        },
        serverFiltering: true,
        schema: {
            data: "data",
            total: "total"                      
        }
    },
    filter: "contains",
    suggest: true,
    index: 3
});
 
$("#ProjectName").kendoComboBox({
    cascadeFrom: "LineOfBusiness",
    autoBind: false,
    dataTextField: "ProjectName",
    dataValueField: "ProjectName",
    dataSource: {                           
        type: "json",
 
        transport: {
            read: "/ajax/projects.php"
        },                           
        serverFiltering: true,
        schema: {
            data: "data",
            total: "total"                      
        }
    },
    filter: "contains",
    suggest: true,
    index: 3
}).data("kendoComboBox");
 
$("#HRLevel").kendoComboBox({
    cascadeFrom: "ProjectName",
    autoBind: false,
    dataTextField: "HRLevel",
    dataValueField: "HRLevel",
    dataSource: {                           
        type: "json",
        transport: {
            read: "/ajax/hrlevels.php"
        },
        serverFiltering: true,
        schema: {
            data: "data",
            total: "total"                      
        }
    },
    filter: "contains",
    suggest: true,
    index: 3
}).data("kendoComboBox");
 
$("#Manager").kendoComboBox({
    cascadeFrom: "HRLevel",
    autoBind: false,
    dataTextField: "ManagerName",
    dataValueField: "ManagerName",
    dataSource: {
        type: "json",
        transport: {
            read: "/ajax/managers.php"
        },
        serverFiltering: true,
        schema: {
            data: "data",
            total: "total"                      
        }
    },
    filter: "contains",
    suggest: true,
    index: 3
}).data("kendoComboBox");
 
var lob = $("#LineOfBusiness").data("kendoComboBox");
var projectname = $("#ProjectName").data("kendoComboBox");
var hrlevel = $("#HRLevel").data("kendoComboBox");
var manager = $("#Manager").data("kendoComboBox");

the first one works fine but when I select an item from it nothing happens to the second one...
I want to be able to select an item from all to send to the server to generate the data for the grid I have below.

1 Answer, 1 is accepted

Sort by
0
Georgi Krustev
Telerik team
answered on 20 Aug 2012, 01:34 PM
Hello David,

 
Here is a quote of the answer of the support ticket opened on the same matter:

Thank you for contacting us. The ComboBox will send "$filter: CategoryID eq 3" request parameter to the server, because it uses ODATA format. Check the DataSource of the combobox. It specifies the "odata" type explicitly. Normally, when the ODATA is not used the request parameters will be like this:

filter[logic]:and
filter[filters][0][field]:CategoryID
filter[filters][0][operator]:eq
filter[filters][0][value]:3
And you can get it on the server like this:
$categoryID = mysql_real_escape_string($_REQUEST["filter"]["filters"][0]["value"]);
I will suggest you check this blog post for more information. You can also check this help topic which covers the cascading combobox scenario.


I will suggest you continue our conversation there in order to avoid any duplications.

Regards,
Georgi Krustev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Tags
ComboBox
Asked by
David OBrien
Top achievements
Rank 1
Answers by
Georgi Krustev
Telerik team
Share this question
or