jQuery UI Widgets Forums Grid jqxGrid Export Issue with Quotes

This topic contains 6 replies, has 5 voices, and was last updated by  svetoslav_borislavov 1 year, 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • jqxGrid Export Issue with Quotes #65388

    Daniel H.
    Participant

    I’m using 3.6.0 Developer License, and I’m having an issue with the ‘exportdata’ method.

    When I choose an export type of CSV or JSON, any fields with data that contain(s) quotation mark(s) is not exported with the quotes escaped, so it is producing invalid CSV and JSON exports. CSV example:

    “ID”, “Date”,”Time”,”Event”
    “1026”, “01/13/2015”,”Username “admin” logged in successfully”

    (Notice ‘admin’ has unescaped quotes around it). This seems to be a bug. The same issue occurs with a JSON export – invalid structure due to lack of escaping. Now, in this example, I could fix it by changing the double-quotes to single-quotes, however, I have data that is encoded as JSON in one of the fields and contains (valid) quotation marks. It would really be nice if I could export data containing double-quotes.

    Is there a quick-and-easy way to fix this?

    Thank you,
    Daniel

    jqxGrid Export Issue with Quotes #65402

    Peter Stoev
    Keymaster

    Hi Daniel,

    No, there’s no API for changing the export logic and put escaping. Probably you can export the data to a variable by not passing file name parameter and parse it on your own.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    jqxGrid Export Issue with Quotes #104537

    Gwyn
    Participant

    I’ve just discovered this. Also, if there are \r\n in any of the cells it also fails to treat that properly.

    This is a bug –> It’s producing an invalid CSV format.

    When will it be fixed?

    jqxGrid Export Issue with Quotes #104539

    Gwyn
    Participant

    As far as I can see it’s a one line fix in jqxdata.export.js

    function prepareData(data, dataOptions) {
    if (dataOptions) {
    var format = me.getFormat(dataOptions);
    data = me.formatData(data, format.type, format.formatString, format.localization);
    }
    //**************************************************
    // data = ‘”‘ + data + ‘”‘;
    data = ‘”‘ + data.replace(/”/g,'””‘).replace(/\r\n/g,’\r’) + ‘”‘;
    //**************************************************
    return data;
    };

    Why after 3+ years of the problem being known that simple fix still hasn’t been made – who knows. But I really don’t want to manage a codeset of simple fixes that you couldn’t be arsed to make – so please – fix it. Soon.

    • This reply was modified 5 years, 1 month ago by  Gwyn.
    jqxGrid Export Issue with Quotes #104575

    Gwyn
    Participant

    Have tested and it actually requires 2 changes to make a CSV file that will properly handle multi-line cells and save in a format that Excel can open (which is what most people use in the business world)

    this.beginRow = function () {
        if ((rowIndex > 0) || (rowIndex == 0 && hasHeader)) {
            //**************************************************
            //file += '\n';
            file += '\r\n';
            //**************************************************
        }
        rowIndex++;
    };
    function prepareData(data, dataOptions) {
        if (dataOptions) {
            var format = me.getFormat(dataOptions);
            data = me.formatData(data, format.type, format.formatString, format.localization);
        }
        //**************************************************
        // data = ‘”‘ + data + ‘”‘;
        data = ‘”‘ + data.replace(/”/g,'””‘).replace(/\r\n/g,’\n’) + ‘”‘;
        //**************************************************
        return data;
    };
    jqxGrid Export Issue with Quotes #132755

    aldous
    Participant

    Hi JQWidgets Team,

    Do you have any plans of integrating this fix in your releases?
    Until now for version v13.2 this bug still exists.

    jqxGrid Export Issue with Quotes #132757

    Hi,

    May you, please, update to the latest version and confirm whether the bug exists?

    Best regards,
    Svetoslav Borislavov

    jQWidgets Team
    https://www.jqwidgets.com/

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

You must be logged in to reply to this topic.