DataDriver is an object that defines a data type.
DHTMLX gives at your disposal 5 main drivers: json, xml, html, csv, jsarray plus additional dhtmlxgrid - data from dhtmlxGrid (compatability_grid.js).
Therewith, you can specify your own data type - create your own driver.
Let's consider this in detail.
The structure of the creation is the following:
dhtmlx.DataDriver.some={ //some - the name of the type toObject:function(text,xml){ ... return text; }, getRecords:function(data){ var result = []; ... return result; }, getDetails:function(data){ var result = {} ... return result; }, getInfo:function(data){ return { _size:some, _from:other }; } };
For a start, we have some data that we want to use as a new data type. The first thing we need to make with this data - convertion into the intermediate object (an object that will be used as input parameter in the other functions ).
So, our first step - toObject(text, xml) function. The function is called after data loading or directly in the parse method and returns the intermediate data object.
Then, we form an array of records using data from our intermediate object.
The second step - getRecords(data) function
Having an array of records we need to specify a set of properties for each single record.
The third step - getDetails(data)
The last action has sense just for dynamic data loading scenarios. It's a function that gets count of data and position at which new data needs to be inserted
The forth step - getInfo(data). The function returns count of data and the appropriate position mentioned above: '0' if a value is unknown or unnessasary.
So, making these four or even three steps you can specify any data type and then use it while developing.