or
<!-- View --><div id="view"> <!-- The value of the INPUT element is bound to the "firstName" field of the View-Model. When the value changes so will the "firstName" field and vice versa. --> <label>First Name:<input data-bind="value: firstName" /></label> <!-- The value of the INPUT element is bound to the "lastName" field of the View-Model. When the value changes so will the "lastName" field and vice versa. --> <label>Last Name:<input data-bind="value: lastName" /></label> <!-- The click event of the BUTTON element is bound to the "displayGreeting" method of the View-Model. When the user clicks the button the "displayGreeting" method will be invoked. --> <button data-bind="click: displayGreeting">Display Greeting</button> </div> <script> // View-Model var viewModel = { firstName: "John", lastName: "Doe", displayGreeting: function() { // Get the current values of "firstName" and "lastName" var firstName = this.get("firstName"); var lastName = this.get("lastName"); alert("Hello, " + firstName + " " + lastName + "!!!"); } }; // Bind the View to the View-Model kendo.bind($("#view"), viewModel); </script>// Get the current values of "firstName" and "lastName" var firstName = this.get("firstName"); var lastName = this.get("lastName"); alert("Hello, " + firstName + " " + lastName + "!!!");alert("Hello, " + this.firstName + " " + this.lastName + "!!!");this.firstName = '';this.set("firstName", '');
<div id="kendo-bound-resourcelist" data-bind="visible: isVisible" > <div data-role="grid" data-sortable="true" data-bind="source: items" data-columns='["Title", "PMID", "TypeOfMaterial",""]' data-row-template="row-template"></div> </div> <script id="row-template" type="text/x-kendo-template"> <tr class="k-grid-edit-row"> <td> <span data-bind="text: Title"></span> </td> <td> <span data-bind="text: PMID"></span> </td> <td> <span data-bind="text: TypeOfMaterial[0]"></span> </td> <td> <input type="button" data-bind="click: deleteItem" value="Delete" /> </td> </tr> </script>this._viewModel = kendo.observable({ items: [], isVisible: function () { return this.get("items").length > 0 ? true : false; }, deleteItem: function (resource) { this.get("items").pop(resource); } });var deletedId = resource.data.Id;var items = this.get("items");for (var i = 0; i < items.length; i++) { if (items[i].Id === deletedId) { this.get("items").pop(items[i]); }}