Your search did not match any results.
Tree List

Web API Service

To access a Web API service from the client, use the createStore method from the DevExtreme.AspNet.Data extension. This extension also allows you to process data for DevExtreme components on the server. The server-side implementation is available under the TreeListTasksController.cs tab in the ASP.NET MVC and ASP.NET Core versions of this demo.

To notify the TreeList that data is processed on the server, set the remoteOperations property to true.

Copy to CodePen
Apply
Reset
$(function(){ var url = "https://js.devexpress.com/Demos/Mvc/api/TreeListTasks"; $("#tree-list").dxTreeList({ 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, showBorders: 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(); } }); });
<!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.5.1/jquery.min.js"></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/21.1.4/css/dx.common.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/21.1.4/css/dx.light.css" /> <script src="https://cdn3.devexpress.com/jslib/21.1.4/js/dx.all.js"></script> <script src="https://unpkg.com/devextreme-aspnet-data@2.8.2/js/dx.aspnet.data.js"></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"></div> </div> </body> </html>
#tree-list { max-height: 640px; }