I am trying to do a custom paging by using mvvm, datasource and template. My problem is I have to use this.set to set the dataSource page() or total pages() to get the value this.get("dataSource").totalPages() or this.get("dataSource").page() refreshed. That is why I set a variable pageRefreshHolder as work-around. Is there some easy way?
var viewModel=kendo.observable({ dataSource:new kendo.data.DataSource({ data:ReportsData, pageSize:12, sort:{ field: "name", dir: "asc" } }), copy:function(e){ this.dataSource.add(e.data); this.set("pageRefreshHolder",this.dataSource.totalPages()); //I have to have this line to get the totalPage work }, goToNextPage:function(){ if(this.dataSource.page()<this.dataSource.totalPages()) this.dataSource.page(this.dataSource.page()+1); else this.dataSource.page(1); $jquery("#reportsArea").find("div#phItem").show("slide",{direction:"right"}, 500); this.set("pageRefreshHolder",this.dataSource.page()); //I have to have this line to get the currentPage work }, goToPrevPage:function(){ if(this.dataSource.page()>1) this.dataSource.page(this.dataSource.page()-1); else this.dataSource.page(this.dataSource.totalPages()); $jquery("#reportsArea").find("div#phItem").show("slide",{direction:"left"}, 500); this.set("pageRefreshHolder",this.dataSource.page()); //I have to have this line to get the currentPage work }, pageRefreshHolder: 1, totalPage: function() { return this.get("dataSource").totalPages(); }, currentPage: function(){ return this.get("dataSource").page(); } }); kendo.bind($jquery("#reportsArea"),viewModel);Hi all,
I am trying to use the Kendo TreeView for a .NET application where people can edit a hierarchy. So far I have most of the client-side functionality implemented, whereby users can move, delete, rename nodes etc. My issue now is how to propagate those changes back to my application where server-side code will make database changes based on those client-side hierarchy changes. Can anybody advise me on the best way to propagate changes made to the treeview back to my .NET app? I’ve looked into the possibility of using a hidden field which I can post back on form submission but I’m not sure if this is the best way to go about it.
Kind regards,
Richard
<!DOCTYPE html><html><head> <title></title> <link href="styles/kendo.mobile.all.min.css" rel="stylesheet" type="text/css" /> <link href="inwx.css" rel="stylesheet" type="text/css" /> <script src="js/jquery.min.js" type="text/javascript"></script> <script src="js/kendo.mobile.min.js" type="text/javascript"></script></head><body> <div id="menu" data-role="view" data-title="Start"> <div class="head"> </div> <ul data-role="listview" data-style="inset" data-type="group" id="listview-menu"> <li>I want to: <ul> <li data-icon="play"><a href="#searchform">search domains</a></li> </ul> </li> </ul></div> <div data-role="view" data-title="Destinations" id="domainlist" data-init="initListView"> <ul data-role="listview" data-style="inset" data-type="group" id="listview-domains"> </ul></div><div id="searchform" data-role="view" data-title="Domain Search" data-init="initForm"> <form> <ul data-role="listview" data-style="inset"> <li> <select id="region-value" data-bind="source: regions, value: region"></select> search region </li> <li> <input id="domain-value" type="text" data-bind="value: domain" /> domain </li> </ul> <button data-bind="click: startSearch">search</button> </form></div><script type="text/x-kendo-template" id="domainlistItemTemplate"> <li data-icon= # if (status == 'used') { # "globe" #} else {# "toprated" #}#> #: domain # </li></script><script> var template = kendo.template($("#domainlistItemTemplate").html());</script><script src="domainlist.js" type="text/javascript"></script></body></html>var initForm;var initListView;$(document).ready(function(){alert("ready");var app = new kendo.mobile.Application(document.body);var domainsearchModel = new kendo.data.ObservableObject({ domain: "sebastian", region: "EUROPE", regions: ["EUROPE", "ASIA", "AMERICAS", "AFRICA", "ALL"], startSearch: function() { app.navigate("#domainlist"); }});var domainlistSource = new kendo.data.DataSource({ transport: { read: { type: "POST", dataType: "json", data: { d: function() { return domainsearchModel.get("domain"); }, r: function() { return domainsearchModel.get("region") } } } }, schema: { data: function(data) { return data.items; }, type: "json" }, group: { field: "country" }, filter: [{ field: "status", operator: "neq", value: "error" }, { field: "status", operator: "neq", value: "timeout" }, { field: "status", operator: "neq", value: "yours" }, { field: "status", operator: "neq", value: "unsupported" }], pagesize: 20}); $("#listview-domains").kendoMobileListView({ style: "inset", template: "#: domain #",// template: template, dataSource: domainlistSource });initForm = function () { var body = $(".km-vertical,.km-horizontal"); kendo.bind($("#searchform"), domainsearchModel);};initListView = function () { };});