SMART datagrid v.1 > Classes > GridDataSet

Back  Forward

DataLudi.GridDataSet.exportToJson  method

Convert data set to json object array according to the setting which is specified in parameter options

If specify the array of including row numbers in startRow parameter, it will return the object of specified rows. 

function exportToJson (options: Object|DataOutputOptions, startRow: Integer|[Integer], count: Integer, emptyValue: *): Object;
Returns
Object
Parameters
options - Object|DataOutputOptions. required.
startRow - Integer|[Integer]. Defaults to 0.
count - Integer.
emptyValue - *.
Note
Code -1
    var obj = dsMain.exportToJson({
        datetimeFormat: 'yyyy/MM/dd',
        valueCallbacks: {
            "cust_id": function (row, field, value) {
                if (value && value.indexOf('(') == 0) {
                    return value + ' Inc.';
                }
                return value;
            }
        }
    });
    var s = JSON.stringify(obj);
    DataLudi.saveJsonToFile(s, 'dataludidata.json');
See Also
DataOutputOptions
GridDataSet.exportToCsv
Examples
Grid Data Set Export