jQWidgets Forums

jQuery UI Widgets Forums Grid Export to CSV Not Working with DateTime Field

This topic contains 1 reply, has 2 voices, and was last updated by  Hristo 9 years, 3 months ago.

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

  • speschka
    Participant

    I have a grid that correctly displays all the data, including a datetime field. However when I export the grid data to CSV, the datetime field values are a mystery. Some are right, many are wrong, but I can’t seem to find any rhyme or reason as where it’s coming up with the values. I’m just using the simplest out of the box export function:

    $(“#jqxgrid”).jqxGrid(‘exportdata’, ‘csv’, jqxgrid);

    The code to create the grid looks like this (“data” is a chunk of JSON returned from a REST call):

    var source =
    {
    localdata: data,
    datatype: “json”
    };

    var dataAdapter = new $.jqx.dataAdapter(source,
    {
    loadComplete: function (data) { },
    loadError: function (xhr, status, error) { }
    });

    $(“#jqxgrid”).jqxGrid(
    {
    source: dataAdapter,
    sortable: true,
    editable: true,
    pageable: true,
    autoshowfiltericon: true,
    pagesizeoptions: [’20’, ’40’, ’60’],
    height: 300,
    columnsresize: true,
    width: 1020,
    columns: [
    { text: ‘Subscription ID’, datafield: ‘SubscriptionId’, width: 150 },
    { text: ‘Date Created’, datafield: ‘DateCreated’, width: 150, type:’date’ },
    { text: ‘Company Name’, datafield: ‘CompanyName’, width: 120 },
    { text: ‘Contact Email’, datafield: ‘ContactEmail’, width: 140 },
    { text: ‘IsActive’, datafield: ‘IsActive’, width: 100, filtertype: ‘list’ },
    { text: ‘IsMonitoring’, datafield: ‘IsMonitoring’, width: 100, filtertype: ‘list’ }
    ]
    });

    Everything works fine other than the date value. I have a cleansed version of actual data and the data that it is exporting if that helps.


    Hristo
    Participant

    Hello speschka,

    Please, take a look our demo:
    http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxgrid/dataexport.htm?light
    (there everything work fine)
    Is it possible to not set correct datafields in dataAdapter?

    Best Regards,
    Hristo Hristov

    jQWidgets team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.