Your search did not match any results.
TreeList

Web API Service

Documentation

This example demonstrates the TreeList widget communicating with a Web API service. Most of the TreeList features are enabled, including the header filter, search panel, lookup columns. All data editing and data processing operations are delegated to the server. To see the server implementation, open the TreeListDemosController tab in the MVC approach.

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, 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.1.0/jquery.min.js"></script> <script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery-3.1.0.min.js"%3E%3C/script%3E'))</script> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/17.2.4/css/dx.spa.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/17.2.4/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/17.2.4/css/dx.light.css" /> <script src="https://cdn3.devexpress.com/jslib/17.2.4/js/dx.all.js"></script> <script src="https://unpkg.com/devextreme-aspnet-data@1.2.4"></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: 440px; }