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.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • Grid export not showing correct values #122394

    JacoMyburgh
    Participant

    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

    Grid export not showing correct values #122395

    ivanpeevski
    Participant

    Hi Jaco,

    The values are shortened, since there is no space left in the table column.
    As a workaround, you can use exportview with pdf. The exported table has dynamic row height and all values will be visible.
    See demo here: Data Export

    Best Regards,
    Ivan Peevski
    jQWidgets team
    https://www.jqwidgets.com

    Grid export not showing correct values #122397

    JacoMyburgh
    Participant

    Thanks 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.

    Grid export not showing correct values #122400

    JacoMyburgh
    Participant

    The other problem with exportview is that it ignoress all columns that was hidden with column selector

    Grid export not showing correct values #122402

    ivanpeevski
    Participant

    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

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.