jQWidgets Forums

jQuery UI Widgets Forums Grid Date format

Tagged: 

This topic contains 8 replies, has 3 voices, and was last updated by  Peter Stoev 11 years, 12 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Date format Posts
  • Date format #19158

    miklosz
    Member

    Hi, I tried to set custom date format in DateTime column, and couldn’t work it out. Is there any way ?

    Another thing , I can’t see Search option in this forum. It makes real headache to find anything.
    Thanks !

    EDIT : Found Search in Dashboard section.

    Date format #19160

    miklosz
    Member

    I should have added that date is taken from MS SQL database , and is in format :

    Jul 30 2012 12:04:00:000PM.

    I tried several cellsformat dates and nothing works. I would like to have it displayed as

    dd-MM-yyyy.

    Thanks.

    Date format #19174

    Peter Stoev
    Keymaster

    Hi miklosz,

    Did you set “type: ‘date'” when you initialized the datafields array of the source object?
    Do you use jQWidgets 2.8.1?

    If you have set the type: ‘date’ of the data field, then please send us a sample which demonstrates your scenario.

    Best Regards,
    Peter Stoev

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

    Date format #19185

    miklosz
    Member

    So … it looks like this:

    var source =
    {
    datatype: “json”,
    datafields: [
    // Jul 30 2012 12:04:00:000PM – it’s like date is sent here
    { name: ‘CompletionDueDate’, type: ‘date’, format: ‘MMM d yyyy HH:mm:ss.fff’},
    { name: ‘ToolReference’},
    { name: ‘CustomerName’},
    { name: ‘CurrentProcess’}
    ],
    url: ‘grid_data.php’,
    cache: false
    };

    I tried several format patterns, nothing works.

    Json record passed is :

    [{“CompletionDueDate”:”Feb 23 2012 09:15:00:000AM”,
    “ToolReference”:”11111″,
    “CustomerName”:”test1″
    ,”CurrentProcess”:”P1″}, …

    And later in grid settings

    columns: [
    { text: ‘Due Date’, datafield: ‘CompletionDueDate’, width: 200, cellsformat: ‘d’ },
    { text: ‘Kit No’, datafield: ‘ToolReference’, width: 60},
    { text: ‘Customer Name’, datafield: ‘CustomerName’, width: 230 },
    { text: ‘Process’,datafield: ‘CurrentProcess’,width: 200 }

    Whatever cellsformat I set, even stupid one, looks like it’s not read by grid at all.

    Thanks for any help.

    Date format #19186

    miklosz
    Member

    Hi,

    I did overcome this issue in completely different way. I process andformat date in grid_data.php file :

    $temp_date = date_parse($row[‘CompletionDueDate’]);
    $new_date = $temp_date[“day”].’-‘.$temp_date[“month”].’-‘.$temp_date[“year”];

    And then cellsformat works as required. Hope it might help others.

    Thanks anyway,

    Date format #22639

    Is there a way to custom format the date in the columns definition? I wouldn’t like to do what miklosz did…

    Thanks,

    Date format #22640

    Peter Stoev
    Keymaster

    Hi,

    The “cellsformat” column property enables you to specify the Format of the Date. You may learn more about the column’s “cellsformat” in the Grid’s API after expanding the “columns” section. In case you wish to override the rendering of a column, you may use the “cellsrenderer” callback instead which is also per column.

    Best Regards,
    Peter Stoev

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

    Date format #22643

    The cellrenderer works fine. The only thing is that the filter won’t follow the same pattern.

    I see in your API (jqxgrid.js) some other formats:

    Were they supposed to work?

    Thanks!

    Date format #22646

    Peter Stoev
    Keymaster

    Hi,

    1. Please, do not post code from jqxgrid.js or any other script file as that is in violation with the EULA!
    2. You can find the supported formats in the Grid’s API in the columns section.

    Best Regards,
    Peter Stoev

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

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

You must be logged in to reply to this topic.