The dxDataGrid binding using a CustomStore help topic and the A custom data source does not apply paging, filtering, sorting and grouping article describe how to implement a custom data source that loads data for a dxDataGrid. This example demonstrates how to make a custom store for the dxDataGrid widget manipulate data. For this purpose, we need to implement the insert, update and remove methods in our custom store. Each of these methods will be called automatically by the widget.
The insert method accepts a parameter that contains values for a new item. The update method accepts two parameters: the first one is a key value of the editing row, and the second one contains values of modified data fields. The remove method accepts a parameter that contains a key value of the deleted row. When a method is called, we need to send a corresponding request to our data service and pass the required parameters. We use jQuery.ajax for sending requests to our data service.
Starting with 15.2, dxDataGrid supports the sorting, filtering, grouping, paging and summary operations on the server side. See Use CustomStore - Remote Operations to learn more. It is not necessary to implement a custom store manually. It is sufficient to create it using the DevExpress.data.AspNet.createStore method implemented in the dx.aspnet.data.js library. This library is a part of the DevExtreme.AspNet.Data data layer extension for ASP.NET MVC. Please take a look at the db.js file to see how to create a custom data store using the DevExpress.data.AspNet.createStore method. You can test this solution with the data service implemented in the How to implement a data service that supports remote operations for dxDataGrid example.
For versions prior to 15.2:
This example can be tested with a data service from How to implement the Rest service based on an ASP.NET WebAPI application.
See also:
Use CustomStore - Remote Operations
Deferred Object
jQuery.extend
How to implement CRUD operations with a DataSource
dxDataGrid - How to implement a custom store with CRUD operations (SQLite)
Question Comments
Added By: Matthias Klein at: 10/6/2015 11:05:23 AM
Is this a typo in line 20? ("lebgth")
Added By: Matthias Klein at: 10/6/2015 12:05:10 PMI have a date field in my dxDataGrid. When I update or insert a row the date is in the Format: "Thu Oct 08 2015 20:55:06 GMT +0200)". How can I change the format in which the date fields will be transfered as data?
Added By: Nikolai (DevExpress Support) at: 10/7/2015 2:23:35 AM Hi Matthias,Thank you for bringing this to our attention. I've updated our code.
As for "date field in my dxDataGrid", I've created a new ticket regarding this issue. Please post your comments in the T297669: dxDataGrid passes the string interpretation of a Date value to insert/update methods of CustomStore ticket.
Added By: David Karasek 2 at: 5/2/2016 11:08:20 AM
Where is the code/JSON resource file for this service?
url: 'http://localhost:59611/Categories',
Added By: Nikolai (DevExpress Support) at: 5/3/2016 2:07:34 AM Hi David,If you take a closer look at the decription of this example, you will see the following:
"Starting with 15.2, dxDataGrid supports sorting, filtering, grouping, paging and summary operations on the server side. See Use CustomStore - Remote Operations to learn more. The How to implement a data service that supports remote operations for dxDataGrid example demonstrates how to do this. You can use this example as a data service."
Use the How to implement a data service that supports remote operations for dxDataGrid example as the required data service.