ComboBox Fake Ajax

by krustev

HTML

<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.common.min.css">
<link rel="stylesheet" href="http://cdn.kendostatic.com/2012.3.1114/styles/kendo.default.min.css">
<script src="http://cdn.kendostatic.com/2012.3.1114/js/kendo.all.min.js"></script>
<input id="parent_descriptor" />   <button id="setValue">Set Value</button>

JavaScript

$("#parent_descriptor").kendoComboBox({
  dataSource: {
    transport: {
        read: {
            url: "/echo/json/",
            //using jsfiddle echo service to simulate JSON endpoint
            dataType: "json",
            type: "POST",
            data: {
                // /echo/json/ echoes the JSON which you pass as an argument
                json: JSON.stringify({ data: [], totalCount: 0 })
            }
        }
    },
      schema: {
            data: function(response) {
                return response.data;
            },
            total: function(response) {
                return response.totalCount;
            }
        }
  }
}); 

$("#setValue").click(function() {
    $("#parent_descriptor").data("kendoComboBox").value("1");
});