static void OnReady() { // create a template using the above definition var template = Kendo.template(new jQuery("#template").html()); var dataSource = new DataSource(new DataSourceConfiguration { pageSize = 10, data = People.createRandomData(500), // subscribe to the CHANGE event of the data source change = () => { // update the max attribute of the "page" input new jQuery("#page").attr("max", [email protected] <DataSource>().totalPages()); new jQuery("#people tbody").html(Kendo.render(template, [email protected] <DataSource>().view())); } }); // read the data dataSource.read(); new jQuery("#apply").click(() => { var page = JsContext.parseInt(new jQuery("#page").val().As <JsString>()); // ,10) // validate the page - it must be a number within the allowed range if (JsContext.isNaN(page) || page < 1 || page > dataSource.totalPages()) { HtmlContext.window.alert(Kendo.format("Page must be a number between 1 and {0}", dataSource.totalPages())); return; } //// query the remote service dataSource.query(new DataSourceConfiguration { page = page, pageSize = 10, //TODO: sortOPtions sort = new { field = new jQuery("#order").val(), dir = new jQuery("#dir").val() } }); }); //initialize dropdownlist components new jQuery("#order").kendoDropDownList(); new jQuery("#dir").kendoDropDownList(); }
static void OnReady() { // TreeView bound to Categories > Products > OrderDetails var OrderDetails = new DataSourceConfiguration { type = "odata", transport = new DataSourceTransportConfiguration { read = new DataSourceTransportReadConfiguration { urlFunc = options => Kendo.format("http://demos.kendoui.com/service/Northwind.svc/Products({0})/Order_Details", options.As <JsObject>()["ProductID"].As <JsNumber>()) } }, schema = new HierarchicalDataSourceSchemaConfiguration { model = new HierarchicalDataSourceSchemaModelConfiguration { hasChildrenFunc = () => false } } }; var Products = new HierarchicalDataSourceConfiguration { type = "odata", schema = new HierarchicalDataSourceSchemaConfiguration { model = new HierarchicalDataSourceSchemaModelConfiguration { id = "ProductID", hasChildrenString = "Order_Details", children = OrderDetails } }, transport = new DataSourceTransportConfiguration { read = new DataSourceTransportReadConfiguration { urlFunc = options => Kendo.format("http://demos.kendoui.com/service/Northwind.svc/Categories({0})/Products", options.As <JsObject>()["CategoryID"].As <JsNumber>()) } } }; var Categories = new HierarchicalDataSource(new HierarchicalDataSourceConfiguration { type = "odata", transport = new DataSourceTransportConfiguration { read = new DataSourceTransportReadConfiguration { url = "http://demos.kendoui.com/service/Northwind.svc/Categories" } }, schema = new HierarchicalDataSourceSchemaConfiguration { model = new HierarchicalDataSourceSchemaModelConfiguration { hasChildrenString = "Products", id = "CategoryID", children = Products } } }); new jQuery("#treeview").kendoTreeView(new TreeViewConfiguration { dataSource = Categories.As <JsArray>(), dataTextField = new JsArray <JsString> { "CategoryName", "ProductName", "OrderID" }.As <JsString>() }); }