Loading Big Datasets (Dynamic)
Generally, in case of dynamic loading a data source is a database.
On the client side you must define the url parameter (or call the load() method) with a file implementing server-side ‘communication’.
Dynamic loading from db. Client-side code
webix.grid({ autoConfig:true, url:"data/data_dyn.php"});
A server-side response should include the following information:
Sample of JSON response
{ "data":[ {"id":1,"package":"acx100-source"}, {"id":2,"package":"acx200-source"} ], "pos":0, "total_count":999}
Related sample: Dynamic Loading from DB
Note that inside dynamic_loading() you should specify the number of records that will be loaded at once.
Dynamic related parameters
Section titled “Dynamic related parameters”There are different properties and methods that can help you configure dynamic loading.
Parameter | Description | Usage example |
---|---|---|
datafetch | Defines the start position DataGrid will load data from | If you want to load the particular number of records (e.g. 80), set datafetch:80. |
datathrottle | Sets polling interval that can be used to decrease the number of requests to the server | As a rule, data are getting loaded when the user starts to scroll DataGrid. If the user scrolls DataGrid slowly, the app pushes a lot of requests to the server, most of which are unnecessary. To exclude unnecessary requests and reduce server overloading, you can set the datathrottle property, for example to 5, and requests will be sent to the server at 5 seconds intervals.
Related sample: DataGrid: Setting Timeout for Dynamic Loading |
loadahead | Allows you to avoid DataGrid from possible 'blank spots' while scrolling | When you start scrolling, DataGrid detects where you scroll (up or down) and loads next records in this direction (the number of records is defined by the parameter). If you set loadahead:50, then on each scrolling movement DataGrid will load next 50 records. |