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

CascadeFrom but do not enable combobox

1 Answer 422 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Daniel Knoll
Top achievements
Rank 1
Daniel Knoll asked on 20 Dec 2012, 02:29 PM
Hi,

I'm using cascading comboboxes like in the Kendo UI samples.

Everything works fine, but I don't want to enable the Checkbox once it is cacaded. I'd like to decide based on other facts if the Combobox whether should be enabled or not.

So how can I disable the feature, that the second combobox is automatically enabled?

Greets

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 21 Dec 2012, 06:44 AM
Hello,

Please try with below code snippet with http://try.kendoui.com/web/widget-initialization/1.


JS
function DisableSecondcombo()
{
     var combobox = $("#products").data("kendoComboBox");
     
        combobox.enable(false);
}
 
$(document).ready(function() {
     
    function onChange() {
    setTimeout(function(){DisableSecondcombo()},1000);
        
    }
     
                    $("#categories").kendoComboBox({
                        placeholder: "Select category...",
                        close: onChange,
                        dataTextField: "CategoryName",
                        dataValueField: "CategoryID",
                        dataSource: {
                            type: "odata",
                            serverFiltering: true,
                            transport: {
                                read: "http://demos.kendoui.com/service/Northwind.svc/Categories"
                            }
                        }
                    });
 
                    var products = $("#products").kendoComboBox({
                        autoBind: false,
                        cascadeFrom: "categories",
                        placeholder: "Select product...",
                        dataTextField: "ProductName",
                        dataValueField: "ProductID",
                        dataSource: {
                            type: "odata",
                            serverFiltering: true,
                            transport: {
                                read: "http://demos.kendoui.com/service/Northwind.svc/Products"
                            }
                        }
                    }).data("kendoComboBox");
 
                    var orders = $("#orders").kendoComboBox({
                        autoBind: false,
                        cascadeFrom: "products",
                        placeholder: "Select order...",
                        dataTextField: "Order.ShipCity",
                        dataValueField: "OrderID",
                        dataSource: {
                            type: "odata",
                            serverFiltering: true,
                            transport: {
                                read: "http://demos.kendoui.com/service/Northwind.svc/Order_Details?$expand=Order"
                            }
                        }
                    }).data("kendoComboBox");
                });


HTML
<div id="example" class="k-content">
 
            <p>
                <label for="categories">Categories:</label>
                <input id="categories"/>
            </p>
            <p>
                <label for="products">Products:</label>
                <input id="products" disabled="disabled" />
            </p>
            <p>
                <label for="orders">Orders:</label>
                <input id="orders" disabled="disabled" />
            </p>
</div>


Thanks,
Jayesh Goyani
Tags
ComboBox
Asked by
Daniel Knoll
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or