Hello,
I want to achieve that my users can reduce / select the columns of the grid using the new “columnchooser” and then only export these columns.
To achieve this, I have used the script suggested by Hristo:
var columns = $("#jqxgrid").jqxGrid("columns");
for (var column of columns.records) {
if (column.hidden) {
$("#jqxgrid").jqxGrid("setcolumnproperty", column.datafield, "exportable", false);
} else {
$("#jqxgrid").jqxGrid("setcolumnproperty", column.datafield, "exportable", true);
}
}
This marks the columns, that should not be exported and so works perfectly when using the old “exportdata” function of the grid:
$("#MyGridID").jqxGrid('exportdata', 'csv', "ExportFileNameExample", true, null, true, "https://example.com/path/to/dataexport.php");
But I want to use the new “exportview” function of the grid to export – amongst other things – xlsx data.
So I use instead:
$("#MyGridID").jqxGrid('exportview', 'csv', "ExportFileNameExample", true, null, true);
The problem is, that “exportview” does not respond to the columns property “exportable” and so all columns will be exported – regardless what is set through “columnchooser”.
I can’t find any entry about “exportview” in the api documentation.
Is there any other way to achieve my goal? Any suggestions?
With regards
DeployDuck