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

Cascade combobox

1 Answer 85 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 26 Mar 2013, 10:02 PM
I having a problem with the cascade combobox.  Here is the code with the json file.  I get undefined in the dropdown lists

            <div class="demo-section">
                <h2>View Order Details</h2>
                <p>
                    <label for="categories">Categories:</label><input id="categories" style="width: 300px" />
                </p>
                <p>
                    <label for="products">Products:</label><input id="products" disabled="disabled" style="width: 300px" />
                </p>
                <p>
                    <label for="orders">Orders:</label><input id="orders" disabled="disabled" style="width: 300px" />
                </p>

                <button class="k-button" id="get">View Order</button>
            </div>

            <style scoped>
                .demo-section {
                    width: 460px;
                    padding: 30px;
                }
                .demo-section h2 {
                    text-transform: uppercase;
                    font-size: 1.2em;
                    margin-bottom: 30px;
                }
                .demo-section label {
                    display: inline-block;
                    width: 120px;
                    padding-right: 5px;
                    text-align: right;
                }
                .demo-section .k-button {
                    margin: 20px 0 0 125px;
                }
                .k-readonly
                {
                    color: gray;
                }
            </style>

            <script>
                $(document).ready(function() {
                    var categories = $("#categories").kendoComboBox({
                        placeholder: "Select category...",
                        dataTextField: "categories",
                        dataValueField: "id",
                        dataSource: {
                            type: "json",
                            serverFiltering: true,
                            transport: {
                                read: "datasources/categories.json"

                            }
                        }
                    }).data("kendoComboBox");

                    var products = $("#products").kendoComboBox({
                        autoBind: false,
                        cascadeFrom: "categories",
                        placeholder: "Select product...",
                        dataTextField: "ProductName",
                        dataValueField: "Productsku",
                        dataSource: {
                            type: "json",
                            serverFiltering: true,
                            transport: {
                                read: "datasources/offerProducts.json"
                            }
                        }
                    }).data("kendoComboBox");


JSON

[{
    "categories": "Discount",
    "id": 1,
}, {
    "categories": "Points",
    "id": 2,
}, {
    "categories": "Member Status",
    "id": 3,
}, {
    "categories": "Charity",
    "id": 4,
}, {
    "categories": "Special Occasions",
    "id": 5,
}]

1 Answer, 1 is accepted

Sort by
0
Dimiter Madjarov
Telerik team
answered on 28 Mar 2013, 01:03 PM
Hi John,


The provided part of the code seems correct, but I am not aware what exactly is the JSON, returned for the child ComboBox. Here you could find detailed explanation of the Cascading Combo Boxes and the way they are configured. I also prepared the following simplified JS Bin demo which covers your scenario. I just added some sample data for the Child Combo.

 

All the best,
Dimiter Madjarov
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
John
Top achievements
Rank 1
Answers by
Dimiter Madjarov
Telerik team
Share this question
or