I am unable to export data from a grid that is set to load data from a server and is in virtual mode.
The I noticed this (I added the ** for emphasis):
>>Exports all rows **loaded within the Grid** to Excel, XML, CSV, TSV, HTML or JSON.
Does that mean the export only works for local data?
The error I get when I invoke the exportdata function is: ‘No data to export’
The grid certainly has data in it.
var source =
{
datatype: 'json'
,type: 'POST'
,datafields: [
{ name: 'id', type: 'integer' }
,{ name: 'firstName', type: 'string' }
,{ name: 'surname', type: 'string' }
]
, url: appInfo.currentPHPScript
, root: 'Rows'
, id: 'id'
, cache: false
, beforeprocessing: function(data) {
source.totalrecords = data.TotalRows;
}
};
var dataAdapter = new $.jqx.dataAdapter(source
, {
formatData: function (data) {
// removed code to keep this msg short
return data;
}
, loadError: function (xhr, status, error) {
alert(error);
}
});
var settings = {
width: '100%'
//,source: dataAdapter // This is done later in code...
,columnsresize: true
,altrows: true
,autosavestate: true
,sortable: true
,pageable: true
,virtualmode: true
,autoheight: true
,rendergridrows: function(obj)
{
return obj.data;
}
,columns: [
{text: 'id', datafield: 'id', width: 55}
,{text: 'Name', datafield: 'firstName', width: 95}
,{text: 'Surname', datafield: 'surname', width: 85}
]
};
$(dataTable).jqxGrid(settings);