or
$("#add-button").click(function () { dataSource.add({ "TITLE": "asd", "PRIORITY": 3, "DEADLINE": "2013-02-02", "DONE": false }); dataSource.sync(); });
01.var _ds = new kendo.data.DataSource({02. serverfiltering: true,03. transport: {04. read: {05. url: "ashx/Main/GetAvailableOUs.ashx",06. dataType: "json",07. data: { searchSTR: searchSTR_ }08. }09. },10. schema: {11. model: {12. id: "text",13. fields: {14. value: { from: "OUid", type: "number" },15. text: { from: "OU", type: "text" },16. Img: { from: "Img", type: "text" },17. isActive: { from: "IsActive", type: "number" }18. }19. }20. }21.});22. 23.$("#OUSelector").kendoComboBox({24. dataTextField: "text",25. dataValueField: "value",26. dataSource: _ds,27. minLength:3,28. ignoreCase: false,29. autoBind: false,30. highlightFirst: false,31. change: function (e) {32. _ds.options.transport.read.data = { searchSTR: e.sender._selectedValue };33. _ds.read();34. },35. filter: "contains",36. template: '# if (Img == "") ' +37. '{# <span id="#: value #" style="display:block;margin:-1px -5px -2px -5px;padding:0 5px; # if (isActive == 0) {# background:red;color:white; #}#">#: text #</span> #}' +38. 'else' +39. '{# <span id="#: value #" style="display:block;margin:-1px -5px -6px -5px;padding:0 5px; # if (isActive == 0) {# background:red;color:white; #}#"><img src="/img/#: Img #.png" alt="#: text #" />#: text #</span> #}#',40. select: function (e) {41. kMain.fn_logon_to_company($(e.item[0]).children("span").attr('id'));42. }43.});44. 45.$(".OUSelectorContainer .k-input").on('keydown', function (e) {46. e.sender = { _selectedValue: e.currentTarget.value };47. var ouselect_ = $("#OUSelector").data("kendoComboBox");48. 49. ouselect_.options.change(e);50.});