Your search did not match any results.
Documentation

This example demonstrates the TreeList widget communicating with a Web API service. All data editing and data processing operations are delegated to the server. The DevExtreme.AspNet.Data extension’s DevExpress.data.AspNet.createStore method configures access to the server from the client. The server implementation is available under the TreeListTasksController tab in the ASP.NET MVC version of this demo.

Copy to CodePen
Apply
Reset
window.onload = function() { var url = "https://js.devexpress.com/Demos/Mvc/api/TreeListTasks"; var viewModel = { treeListOptions: { dataSource: DevExpress.data.AspNet.createStore({ key: "Task_ID", loadUrl: url + "/Tasks", insertUrl: url + "/InsertTask", updateUrl: url + "/UpdateTask", deleteUrl: url + "/DeleteTask", onBeforeSend: function(method, ajaxOptions) { ajaxOptions.xhrFields = { withCredentials: true }; } }), remoteOperations: { filtering: true, sorting: true, grouping: true }, parentIdExpr: "Task_Parent_ID", hasItemsExpr: "Has_Items", expandedRowKeys: [1, 2], searchPanel: { visible: true }, headerFilter: { visible: true }, editing: { mode: "row", allowAdding: true, allowUpdating: true, allowDeleting: true }, showRowLines: true, columnAutoWidth: true, wordWrapEnabled: true, columns: [{ dataField: "Task_Subject", minWidth: 250, validationRules: [{ type: "required" }] }, { dataField: "Task_Assigned_Employee_ID", caption: "Assigned", minWidth: 120, lookup: { dataSource: DevExpress.data.AspNet.createStore({ key: "ID", loadUrl: url + "/TaskEmployees" }), valueExpr: "ID", displayExpr: "Name" }, validationRules: [{ type: "required" }] }, { dataField: "Task_Status", caption: "Status", minWidth: 120, lookup: { dataSource: [ "Not Started", "Need Assistance", "In Progress", "Deferred", "Completed" ] } }, { dataField: "Task_Start_Date", caption: "Start Date", dataType: "date" }, { dataField: "Task_Due_Date", caption: "Due Date", dataType: "date" } ], onInitNewRow: function(e) { e.data.Task_Status = "Not Started"; e.data.Task_Start_Date = new Date(); e.data.Task_Due_Date = new Date(); } } }; ko.applyBindings(viewModel, document.getElementById("tree-list-demo")); };
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>DevExtreme Demo</title> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.4.2/knockout-min.js"></script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/18.1.4/css/dx.spa.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/18.1.4/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/18.1.4/css/dx.light.css" /> <script src="https://cdn3.devexpress.com/jslib/18.1.4/js/dx.all.js"></script> <script src="https://unpkg.com/devextreme-aspnet-data@1.4.7"></script> <link rel="stylesheet" type ="text/css" href ="styles.css" /> <script src="index.js"></script> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="tree-list-demo"> <div id="tree-list" data-bind="dxTreeList: treeListOptions"></div> </div> </div> </body> </html>
#tree-list { max-height: 640px; }