ComboBox without custom value

by krustev

HTML

<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.1.322/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.1.322/styles/kendo.default.min.css">
<script src="http://cdn.kendostatic.com/2012.1.322/js/kendo.all.min.js"></script>
<input id="suppliers" value="2"/>

JavaScript

$("#suppliers").kendoComboBox({
    dataTextField: "CompanyName",
    dataValueField: "SupplierID",
    dataSource: {
        type: "odata",
        serverFiltering: true,
        transport: {
            read: "http://services.odata.org/Northwind/Northwind.svc/Suppliers"
        }
    },
    change: function() {
       var value = this.value();
        if (value && this.selectedIndex == -1) {
            alert("Custom value");
            this.value("");
        }            
    }
});

var combobox = $("#suppliers").data("kendoComboBox");

combobox.input.bind("keydown", function(e) {
    if (e.keyCode == 40) {
        combobox.open();
    }        
});