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 that works with a SQLite data source. For this purpose, the SQLite PhoneGap plugin is used. Note how the custom store's insert, update and remove methods are implemented to use the plugin's API. Each of these methods will be called automatically by the widget. When a method is called, we need to execute a corresponding SQL query and pass the required parameters. Note that in order to work with the database, it is necessary to initialize it in the "deviceready" event handler:
[JScript]//index.js $(document).on("deviceready", function(){... window.db = window.sqlitePlugin.openDatabase({ name: "DB"});});
Note how the deferred object resolves the amount of affected rows in each method and the reject function receives the exception message. This allows displaying the query execution exception in the grid's error row.
The example contains a ready-to-use package file for Android, so you can install and test it right away. Any modification or building the package for iOS will require going through steps described in Packaging.
See also:
Deferred Object
How to implement CRUD operations with a DataSource
dxDataGrid - How to implement a custom store with CRUD operations
Question Comments
Added By: Vivek Kanakia at: 7/3/2015 7:21:12 AM
Hi,
I want to create mobile and web app using devExtreme
I want to give user offline capability.
Does devExtreme support CRUD operations out-of-the-box for offline storage.
Do you have sample code which demonstrates how to make a custom store like SQLite data source. Or any other data source.
I am interested in knowing insert, update and remove methods implemention. Each of these methods needs to be called automatically by the widget.
Thanks & Regards,
Deepak Chavan, PMP
Hello,
To process your recent post more efficiently, I created a separate ticket on your behalf: T263266: Inquires regarding the offline storage . This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.