jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Grid export not showing correct values
This topic contains 4 replies, has 2 voices, and was last updated by ivanpeevski 2 years, 10 months ago.
-
Author
-
When exported data using “.jqxGrid(‘exportdata’, ‘pdf’, ‘jqxGrid’)” all the values are not shown correctly. The last few characters are replaced with ellipses. Like values of Firstname and Surname are being displayed as “FirstN… Surn…”.
If I export in csv for example the values are being displayed correctly.
Any ideas?
Thanks
Hi Jaco,
The values are shortened, since there is no space left in the table column.
As a workaround, you can useexportview
with pdf. The exported table has dynamic row height and all values will be visible.
See demo here: Data ExportBest Regards,
Ivan Peevski
jQWidgets team
https://www.jqwidgets.comThanks for the response. I’ve added the additional libraries and changed to exportview. This resolve the data format issue, but brought about a new issue. If the grid contains any null values to export fails.
The other problem with exportview is that it ignoress all columns that was hidden with column selector
Hi Jaco,
1) You can use
beforeLoadComplete
to get rid of null values and replace them with empty strings.
` var dataAdapter = new $.jqx.dataAdapter(source, {
autoBind: true,
beforeLoadComplete: function(records){
var data = new Array();
for (var i = 0; i < records.length; i++) {
var record = records[i];
if(record.firstname == null){
record.firstname = ”;
}
data.push(record);
}
return data;
}
});`2) Exportview will export all visible and hidden columns. To make a column unexportable, you should set
exportable:false
. In a Column Chooser, you can implement it in this way:$("#openButton").on('click', function () { $("#grid").jqxGrid('openColumnChooser'); setTimeout( function(){ $(".jqx-listbox").jqxListBox() $(".jqx-listbox").on('checkChange', function (event) { var args = event.args; if (args.checked) { $("#grid").jqxGrid('setcolumnproperty', args.value, 'exportable', true); } else { $("#grid").jqxGrid('setcolumnproperty', args.value, 'exportable', false); } })}, 100) });
Please let me know if this works for you!
Best Regards,
Ivan Peevski
jQWidgets team
https://www.jqwidgets.com -
AuthorPosts
You must be logged in to reply to this topic.