jQWidgets Forums

jQuery UI Widgets Forums Grid Format date source

This topic contains 2 replies, has 2 voices, and was last updated by  jefferson.daris 11 years, 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Format date source #27020

    Hi,

    how to format a date that is being processed in the source.

    exemple:

    var source = {
    datatype: “json”,
    datafields: [{ name: ‘hrmov_seq’, type: ‘number’},
    { name: ‘pac_codigo’, type: ‘number’},
    { name: ‘vig_dt_ag’, type: ‘date’, format:’dd/mm/yyyy’},]};

    There is a possibility to format the date in the table using the cellsformat, but when I try to get the value of the cell with the formatted value to insert the date into the form loads with the default format jqwidget. In that case I would really have to format the date in the source to get the date correctly and move on to the form.

    Format date source #27046

    Peter Stoev
    Keymaster

    Hi jefferson.daris,

    By setting { name: ‘vig_dt_ag’, type: ‘date’, format:’dd/mm/yyyy’} you specify the Format of your Dates in your Date source. The ‘format’ member will be used to parse your Date coming from the Data Source to a JavaScript Date Object. The “cellsformat” on the other hand parses a JavaScript Date Object to a String of any format. The Grid has 2 methods for getting the cell’s value – “getcellvalue” returns the cell’s value and “getcelltext” returns the Text displayed in the cell. Both of these methods accept 2 parameters – row bound index and the column’s datafield.

    Best Regards,
    Peter Stoev

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

    Format date source #27129

    Hi Peter,

    If I take the value of the cell with the user function ‘getcellvalue’ or ‘getcelltext’ I will return the value will be ‘{Date Sat Jun 06 2015 00:00:00 GMT-0300 (Brazil Standard Time)}’, but would to format this date! If you format the column using the ‘cellsformat’ I will return the value that is the same as stated above. Would be able to format this value when selecting a row?

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

You must be logged in to reply to this topic.