or
<div data-bind="source: Fields" data-template="field-template"></div><script id="field-template" type="text/x-kendo-template"> <div> <div data-bind="text: FieldName"></div> <button data-bind="events: { click: removeField }">Remove</button> </div></script>var SectionVM = function (section) { var self = this; this.Fields = []; if (section.Fields) { var fieldIndex = 0; $.each(section.Fields, function () { var field = this; var fvm = new FieldVM(field); // FieldVM is similar with this VM self.Fields.push(fvm); }); } this.removeField = function (e) {
var FieldIndex = self.get("Fields").indexOf(e.data); var removedItem = self.get("Fields").splice(FieldIndex, 1); } self = kendo.observable(this); return self;}var secVM = new SectionVM(someSection); // someSection it's an object comming from the server and matches the VM structurekendo.bind($(".section"), secVM); // .section is a div wrapping the div with the source binding
<div id="categorylist" data-role="view" data-title="Category List" data-layout="checklayout"> <ul data-role="listview" data-style="inset" data-type="group"> <li> Category List <ul> <li> <label> <input name="categorylistradio" type="radio" value="1" data-change="categoryswitch" /> <div style="height: 8px; width:8px; background: #67e667; border:1px; border-style:solid; float:left; margin-right: 3px; margin-top: 7px;"></div>Academic </label> </li> </ul> </li> </ul></div><script> function categoryswitch(e) { alert('test'); } kendo.init($("#categorylist"));</script><div id="newBatchWindow"></div> $("#newBatchWindow").kendoWindow({ width: "425px", height: "375px", title: "New Batch", visible: false, resizable: false, modal: true, content: "/Batch/Create" });
app.provider('remotePersistence', function () { this.$get = function ($resource) { var definitions = { widgets: $resource('http://127.0.0.1:3000\:3000/widget.json',{},{ archive: { method: 'POST', params: { archive: true }}, active: { method: 'POST', params: { active: true }} }) }; var datastore = {} var namespaces = ['widgets']; namespaces.forEach(function (namespace) { datastore[namespace] = { endpoint: definitions[namespace], cache: definitions[namespace].query() }; }); return datastore; }; }); app.controller( "WidgetsSearchController", function ($scope, remotePersistence){ $scope.widgets = undefined; $scope.visibleWidgets = new kendo.data.DataSource({ // data: remotePersistence.widgets.cache, transport: { read: function (options) { options.success(remotePersistence.widgets.cache); } } }); }); //This works but is not desirable style //$scope.widgets = remotePersistence.widgets.query(function(){ $scope.visibleWidgets.data($scope.widgets) });