jQuery UI Widgets Forums Grid Date column in grid show as number

Tagged: ,

This topic contains 6 replies, has 3 voices, and was last updated by  aravindtrue 12 years, 2 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
  • Date column in grid show as number #3621

    mschouten
    Member

    Hi,

    Just started with jqWidget. Works like a charm. Without too much coding it renders records coming from the server. However, I’m having difficulties getting dates to print properly.

    The date column setup is:

    datafields:
    { name: 'uploadDt', type: 'date'},
    columns:
    { text: 'Upload Date', datafield: 'uploadDt', width: 150, cellsformat: 'D'},
    JSON data:
    ...
    [{"id":46,"fileName":"upload_res.xls","securityId":2,"createdBy":5,"creationDt":1334872800000,"updatedBy":5,"updatedDt":1334872800000,"fileType":"Excel","uploadDt":1334872800000,"uploadStatus":"SUCCESS","uploadMessage":"File uploaded"},
    ...

    The ‘uploadDt’ column comes from a timestamp column in my db. I’m assuming that the ‘type’ and ‘cellsformat’ settings should somehow trigger a conversion but I’m seeing ‘1334872800000’ as the column value. I must be doing something wrong. Any suggestions are greatly appreciated.

    Thank & rgds,
    Martin

    Date column in grid show as number #3641

    Peter Stoev
    Keymaster

    Hi Martin,

    Thanks for writing.

    I tested the provided code and observed that the conversion of ‘1334872800000’ to Date object failed. That’s the reason the Grid displays the timestamp value as a Number instead of Date. This is an issue in the built-in Date object parsing of timestamp values and it will be resolved in the upcoming release.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Date column in grid show as number #3675

    mschouten
    Member

    Hi Peter,

    Thanks for the quick response. I’ll work around it by converting it to string and wait for the next release. Any idea on the date?

    Kind regards,
    Martin

    Date column in grid show as number #3698

    Peter Stoev
    Keymaster

    Hi Martin,

    The release is currently scheduled for 05/05/2012. However there could be a small delay in a few days depending on the QA work.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Date column in grid show as number #7884

    aravindtrue
    Member

    Hi Peter,

    I am using version 2.4.1 and still facing this problem. Is this resolved?

    Regards,
    Aravind

    Date column in grid show as number #7885

    Peter Stoev
    Keymaster

    Hi Aravind,

    The issue is fixed. See online demo here: http://jsfiddle.net/jqwidgets/LNBEN/1/

    Here’s a code snippet:

    var data = [{
    "id": 46,
    "fileName": "upload_res.xls",
    "securityId": 2,
    "createdBy": 5,
    "creationDt": 1334872800000,
    "updatedBy": 5,
    "updatedDt": 1334872800000,
    "fileType": "Excel",
    "uploadDt": 1334872800000,
    "uploadStatus": "SUCCESS",
    "uploadMessage": "File uploaded"}];
    var source = {
    localdata: data,
    datatype: "json",
    datafields: [{
    name: 'uploadDt',
    type: 'date'}]
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    $("#jqxgrid").jqxGrid({
    source: dataAdapter,
    columnsresize: true,
    columns: [
    {
    text: 'Name',
    dataField: 'uploadDt',
    cellsformat: 'd'}
    ]
    });​

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    Date column in grid show as number #7902

    aravindtrue
    Member

    Perfect. This is great.. 🙂

    I was working in version 2.4.1 and the demo is having 2.4.2.

    And missed out the ‘type’ for datafields.

    Thanks a lot for helping me out.

    Regards,
    Aravind

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

You must be logged in to reply to this topic.