jQuery UI Widgets Forums Grid Error in excel export: q.toISOString is not a function

This topic contains 4 replies, has 2 voices, and was last updated by  Hristo 2 years, 7 months ago.

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

  • mkrajew
    Participant

    Hello, I’m working on upgrading our jqx control versions from 8.0.0 to 9.0.0 and our Export to Excel function is no longer working, instead giving the following javascript exception:

    jqxdata.export.js?v=9.0.0:8 Uncaught TypeError: q.toISOString is not a function

    In the Chrome debugger, the value of “q” is a string:
    “2020-01-08T14:59:54.258-06:00”

    I’ve tried doing some investigation and nothing out of the ordinary is being done. If I try to export the same data as HTML for printing, it works fine.

    Here’s the code I’m using to do the export:

    function ExportGrid(strType)
    {
        var exportRowData = null;
        switch (strType)
        {
            case "selected":
                exportRowData = GetSelectedRowData();
                break;
            case "page":
                exportRowData = $('#jqxMyRecordsGrid').jqxGrid('getrows');
                break;
            case "all":
                exportRowData = GetAllCachedRowData();
                break;
        }
           
    
        if (exportRowData === null)
            return;
    
        var bExportColumnHeaders = true;
        var bExportHiddenColumns = true;
    
        setTimeout(function ()
        {
            $("#jqxMyRecordsGrid").jqxGrid('exportdata', 'xls', 'MyRecords', bExportColumnHeaders, exportRowData, bExportHiddenColumns, '../../Library/ExportGrid.ashx');
        }, 100);
    };
    

    The exportRowData in this case has the value of:

    pkAMCollectionID: 33928260
    Author: "Archer, Micha,"
    Barcode: ""
    CallNumber: ""
    CreateDate: "2020-01-08T14:59:54.258-06:00"
    Edition: ""
    fkErrorSeverityID: 10
    ImportDate: "2020-01-08T14:59:54.258-06:00"
    ISBN: "9780399546723; 0399546723"
    fkMaterialTypeID: 1
    Pages: "1 volume (unpaged) :"
    PublicationDate: "[2019]"
    Publisher: "Nancy Paulsen Books,"
    Series: ""
    Title: "Daniel's good day /"
    UpdateDate: "2020-01-08T14:59:54.258-06:00"
    CopyCount: 0
    fkJobID: 0
    Custom1: " $a Neighborhoods $v Fiction.;  $a Joy $v Fiction.;  $a Poetry $v Fiction.;  $a Picture books. $2 lcgft"
    Custom2: ""
    Custom3: ""
    Custom4: ""
    Custom5: "text; still image; unmediated; volume"
    ImportedBy: "myusername"
    uid: 3
    boundindex: 3
    uniqueid: "3122-23-26-17-312216"
    visibleindex: 3

    In case you need it, here is the code we are using to define our data source:

    var source = {
            datatype: "json",
            datafields: [
                { name: 'pkAMCollectionID', type: 'int' },
                { name: 'Author', type: 'string' },
                { name: 'Barcode', type: 'string' },
                { name: 'CallNumber', type: 'string' },
                { name: 'CreateDate', type: 'date' },
                { name: 'Edition', type: 'string' },
                { name: 'fkErrorSeverityID', type: 'int' },
                { name: 'ImportDate', type: 'date' },
                { name: 'ISBN', type: 'string' },
                { name: 'fkMaterialTypeID', type: 'int' },
                { name: 'Pages', type: 'string' },
                { name: 'PublicationDate', type: 'string' },
                { name: 'Publisher', type: 'string' },
                { name: 'Series', type: 'string' },
                { name: 'Title', type: 'string' },
                { name: 'UpdateDate', type: 'date' },
                { name: 'CopyCount', type: 'int' },
                { name: 'Custom1', type: 'string' },
                { name: 'Custom2', type: 'string' },
                { name: 'Custom3', type: 'string' },
                { name: 'Custom4', type: 'string' },
                { name: 'Custom5', type: 'string' },
                { name: 'ImportedBy', type: 'string' }
            ],
            type: 'post',
            url: '../../Services/service.asmx/GetJson'
        };

    Again, all we changed was upgrading from version 8.0.0 to 9.0.0.


    Hristo
    Participant

    Hello mkrajew,

    I would like to mention the used from you approach with getrows method for your "page" case it will return all records, too.
    Also, I try to recreate your scenario and it seems to work fine.
    $("#grid").jqxGrid("exportdata", "xls", "MyRecords", bExportColumnHeaders, exportRowData, bExportHiddenColumns, "dataexport.php");
    But for this purpose you should use the XAMPP (or another) to execute *.php” files.
    If you use the ASP.Net and have a Developer or higher license agreement then you could find the NETExport” folder with more details on how to use it.

    Best Regards,
    Hristo Hristov

    jQWidgets team
    https://www.jqwidgets.com


    mkrajew
    Participant

    Thanks for the comments, though it still does not work for us.

    I’ve developed my own caching method with virtualmode so I don’t need to go to the server as often, so this “page” is not the same as what the grid thinks is a page. But that part all works fine. This is some error the grid export is throwing on the client-side before getting to the server (which I already have implemented in .NET).

    Updating all of the jqWidgets files to the latest 9.0.0 version and leaving jqxgrid.export.js at version 8.0.0 appears to work on a surface level, though I’m not sure what other problems we will end up having if we do that. However if we can’t get the new version working, that’s likely what we’ll have to do.


    mkrajew
    Participant

    Correction: it’s jqxdata.export.js (not jqxgrid.export.js) that I’m having problems with. If I leave the old version of jqxdata.export in there, everything appears to work correctly without any exceptions being thrown.


    Hristo
    Participant

    Hello mkrajew,

    I would like to mention that the exporting when the data is loaded on demand – when using virtualmode option.
    Please, take a look at this topic.
    Also, I would like to ask you for the whole example that could be used to reproduce your case.
    After I reproduce it I will create a work item for this or provide you a workaround if it is possible.
    Meanwhile, you could use the old version of the mentioned file.

    Best Regards,
    Hristo Hristov

    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.