jQWidgets Forums

jQuery UI Widgets Forums Grid datetimeinput format issue

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

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • datetimeinput format issue #8838

    rjlewis71
    Member

    I have a date field that I’m pulling out of my database in MM/DD/YYYY format.  In the grid it shows up correctly.  When the user changes it in the grid (using the built-in date picker) the grid shows it the correct way, but when I try to apply it to the database the format is “Mon Nov 22 2010 00:00:00 GMT-0600 (Central Standard Time)” instead of the MM/DD/YYYY that I need.  Why is that?  Is there a way around that?  I really don’t want to parse every date field that I have in my grid (in this case, 5 in each row).
    Robert

    // in my source = line
    { name: 'DATE_RECEIVED', type: 'datetimeinput' },
    // in my columns line
    { text: 'DATE_RECEIVED', dataField: 'DATE_RECEIVED', width: 100, sortable: true,        �
    columntype: 'datetimeinput', cellsalign: 'right', cellsformat: 'MM/dd/yyyy'}
    // in my updaterow function
    "&DATE_RECEIVED=" + rowdata.DATE_RECEIVED +

    datetimeinput format issue #8842

    Peter Stoev
    Keymaster

    Hi Robert,

    The cellsformat specifies the display format of a Date object i.e the Grid converts a Date object to a String with a specific format and displays the string. It does not change the original value, unless you edit it via any of the built-in editors or through an API call. If you want to send formatted Date to your server, you can use the following code snippet to format a Date value.

    var  value = $.jqx.dataFormat.formatdate(date, MM/dd/yyyy', grid.jqxGrid('gridlocalization'));

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

    datetimeinput format issue #8844

    rjlewis71
    Member

    Good deal, thanks!

    Robert

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

You must be logged in to reply to this topic.