Your search did not match any results.
Documentation

This example demonstrates the DataGrid 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 DataGridWebApiController tab in the ASP.NET MVC version of this demo.

Copy to CodePen
Apply
Reset
var DemoApp = angular.module('DemoApp', ['dx']); DemoApp.controller('DemoController', function DemoController($scope) { var url = "https://js.devexpress.com/Demos/Mvc/api/DataGridWebApi"; $scope.gridOptions = { dataSource: DevExpress.data.AspNet.createStore({ key: "OrderID", loadUrl: url + "/Orders", insertUrl: url + "/InsertOrder", updateUrl: url + "/UpdateOrder", deleteUrl: url + "/DeleteOrder", onBeforeSend: function(method, ajaxOptions) { ajaxOptions.xhrFields = { withCredentials: true }; } }), remoteOperations: true, columns: [{ dataField: "CustomerID", caption: "Customer", validationRules: [{ type: "stringLength", message: "The field Customer must be a string with a maximum length of 5.", max: 5 }], lookup: { dataSource: DevExpress.data.AspNet.createStore({ key: "Value", loadUrl: url + "/CustomersLookup", onBeforeSend: function(method, ajaxOptions) { ajaxOptions.xhrFields = { withCredentials: true }; } }), valueExpr: "Value", displayExpr: "Text" } }, { dataField: "OrderDate", dataType: "date", validationRules: [{ type: "required", message: "The OrderDate field is required." }] }, { dataField: "Freight", headerFilter: { groupInterval: 100 }, validationRules: [{ type: "range", message: "The field Freight must be between 0 and 2000.", min: 0, max: 2000 }] }, { dataField: "ShipCountry", validationRules: [{ type: "stringLength", message: "The field ShipCountry must be a string with a maximum length of 15.", max: 15 }] }, { dataField: "ShipVia", caption: "Shipping Company", dataType: "number", lookup: { dataSource: DevExpress.data.AspNet.createStore({ key: "Value", loadUrl: url + "/ShippersLookup", onBeforeSend: function(method, ajaxOptions) { ajaxOptions.xhrFields = { withCredentials: true }; } }), valueExpr: "Value", displayExpr: "Text" } } ], filterRow: { visible: true }, headerFilter: { visible: true }, groupPanel: { visible: true }, scrolling: { mode: "virtual" }, height: 600, showBorders: true, masterDetail: { enabled: true, template: "detail" }, editing: { allowAdding: true, allowUpdating: true, allowDeleting: true }, grouping: { autoExpandAll: false }, summary: { totalItems: [{ column: "Freight", summaryType: "sum" }], groupItems: [{ column: "Freight", summaryType: "sum" }, { summaryType: "count" } ] } }; $scope.getMasterDetailGridSettings = function(order) { return { dataSource: DevExpress.data.AspNet.createStore({ loadUrl: url + '/OrderDetails', loadParams: { orderID : order.OrderID }, onBeforeSend: function(method, ajaxOptions) { ajaxOptions.xhrFields = { withCredentials: true }; } }), showBorders: true }; }; });
<!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/18.1.3/css/dx.spa.css" /> <link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/18.1.3/css/dx.common.css" /> <link rel="dx-theme" data-theme="generic.light" href="https://cdn3.devexpress.com/jslib/18.1.3/css/dx.light.css" /> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.16/angular.min.js"></script> <script>window.angular || document.write(decodeURIComponent('%3Cscript src="js/angular.min.js"%3E%3C\/script%3E'))</script> <script src="https://cdn3.devexpress.com/jslib/18.1.3/js/dx.all.js"></script> <script src="https://unpkg.com/devextreme-aspnet-data@1.4.5"></script> <script src="index.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> </head> <body class="dx-viewport"> <div class="demo-container" ng-app="DemoApp" ng-controller="DemoController"> <div dx-data-grid="gridOptions" dx-item-alias="order"> <div data-options="dxTemplate: {name: 'detail'}"> <div dx-data-grid="getMasterDetailGridSettings(order.data)"></div> </div> </div> </body> </html>