DevExtreme v24.1 is now available.

Explore our newest features/capabilities and share your thoughts with us.

Your search did not match any results.

JavaScript/jQuery Data Grid - Custom Data Source

DevExtreme provides the CustomStore component to load and edit data from a custom data source. In this demo, the CustomStore fetches data from a custom remote server and displays it in the JavaScript DataGrid.

Backend API
$(() => { function isNotEmpty(value) { return value !== undefined && value !== null && value !== ''; } const store = new DevExpress.data.CustomStore({ key: 'OrderNumber', load(loadOptions) { const deferred = $.Deferred(); const paramNames = [ 'skip', 'take', 'requireTotalCount', 'requireGroupCount', 'sort', 'filter', 'totalSummary', 'group', 'groupSummary', ]; const args = {}; paramNames .filter((paramName) => isNotEmpty(loadOptions[paramName])) .forEach((paramName) => { args[paramName] = JSON.stringify(loadOptions[paramName]); }); $.ajax({ url: 'https://js.devexpress.com/Demos/WidgetsGalleryDataService/api/orders', dataType: 'json', data: args, success(result) { deferred.resolve(result.data, { totalCount: result.totalCount, summary: result.summary, groupCount: result.groupCount, }); }, error() { deferred.reject('Data Loading Error'); }, timeout: 5000, }); return deferred.promise(); }, }); $('#gridContainer').dxDataGrid({ dataSource: store, showBorders: true, remoteOperations: true, paging: { pageSize: 12, }, pager: { visible: true, showPageSizeSelector: true, allowedPageSizes: [8, 12, 20], }, columns: [{ dataField: 'OrderNumber', dataType: 'number', }, { dataField: 'OrderDate', dataType: 'date', }, { dataField: 'StoreCity', dataType: 'string', }, { dataField: 'StoreState', dataType: 'string', }, { dataField: 'Employee', dataType: 'string', }, { dataField: 'SaleAmount', dataType: 'number', format: 'currency', }], }).dxDataGrid('instance'); });
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <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=5.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/24.1.7/css/dx.light.css" /> <script src="js/dx.all.js"></script> <script src="index.js"></script> <link rel="stylesheet" type="text/css" href="styles.css" /> </head> <body class="dx-viewport"> <div class="demo-container"> <div id="gridContainer"></div> </div> </body> </html>

The communication between the CustomStore and the server is organized as follows:

  • The CustomStore sends data processing settings to the server (see the load function in the code below).
  • The server applies these settings to data and returns the processed dataset (you should write the server-side code for this).

Each setting has information about a data operation (sorting, filtering, etc.) and is present only if this operation is declared as remote in the JavaScript DataGrid's remoteOperations property. If your server does not support a certain operation, do not declare it as remote to perform it on the client.

For more information about the communication between the client and server in DevExtreme, refer to the following help topic: Server-Side Data Processing.

If your server does not support any data operations, set remoteOperations to false and implement the load function as described in the following help topic: Client-Side Data Processing.

A 1-Click Solution for CRUD Web API Services with Role-based Access Control via EF Core

If you target .NET for your backend API, be sure to check out Web API Service and register your free copy today. The Solution Wizard scaffolds an OData v4 Web API Service (.NET 6+) with integrated authorization & CRUD operations powered by EF Core ORM. You can use OAuth2, JWT or custom authentication strategies alongside tools like Postman or Swagger (OpenAPI) for API testing. The built-in Web API Service also filters out secured server data based on permissions granted to users. Advanced/enterprise functions include audit trail, endpoints to download reports, file attachments, check validation, obtain localized captions, etc.

To use the free Solution Wizard (which creates the Web API Service), run the Universal Component Installer from the DevExpress Download Manager and use our predefined template in Visual Studio 2022+.

Read Tutorial | View Examples: JavaScript (DevExtreme) & JavaScript (Svelte) | Watch Videos