# Remote data
There are several ways to fetch remote data and put into the datagrid:
- external - listen to the datagrid state changes (sorting, pagination), request the data and put it into the datagrid as array/object
- callback - provide the callback function which gets called on each state change, receive the params, load and return the data
- internal - allow the datagrid to load the data itself
# External
In this scenario you do all the work yourself and just provide the datagrid with the final data array/object. You have to listen to the state change events and transform the state to the request params. And its up to you how to get the data from the server. Unfortunately if you want lazy loading this method does not work - you have to use either callback or internal.
# Callback
You can assign a callback function to the rows
or columns
property. In this case there is no need to monitor the state -
the function will be called whenever sorting, filtering or pagination change.
function rows(params){
return $.getJSON(url, params);
}
The function should return an array/object (directly or via promise).
This method is compatible with lazy loading - the function will be called for each data chunk (same as pagination).
# Internal
You can also allow the datagrid to handle data requests internally using available config options, for example http
.
Just configure the transport options and assign URL string to rows
or columns
props.