jQuery UI Widgets Forums Grid date formatting not working

This topic contains 3 replies, has 2 voices, and was last updated by  owen11 8 years, 11 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • date formatting not working #68371

    owen11
    Participant

    Hi

    I’m pretty new to JQWidgets and I am having difficulty getting date formats to work on a grid.

    I am trying to integrate jqwidgets into an MVC project, drawing data from an SQL Server DB (executing stored procedures).
    I have tried many different iterations that I have come across on this site and others.

    Here is the latest:
    var model = {
    patientId: patientIdNotes
    };

    var PatientNotesSource = {
    type: ‘POST’,
    datatype: ‘json’,
    data: model,
    url: ‘../Notes/GetPatientsNotes’,
    datafield: [
    { name: ‘patientNoteId’, type: ‘int’ },
    { name: ‘patientID’, type: ‘string’ },
    { name: ‘noteSubject’, type: ‘string’ },
    { name: ‘noteDateTime’, type: ‘date’, format: ‘MM/dd/yyyy HH:mm:ss’ },
    { name: ‘note’, type: ‘string’ }

    ]
    };

    var PatientNotesAdapter = new $.jqx.dataAdapter(PatientNotesSource);

    PatientNotesGrid.jqxGrid({
    width: ‘100%’,
    selectionmode: ‘singlerow’,
    source: PatientNotesAdapter,
    altrows: true,
    rowsheight: 30,
    autoheight: true,
    filterable: true,
    showfilterrow: true,
    groupable: true,
    pagesize: 15,
    columns: [
    { text: ‘Subject’, datafield: ‘noteSubject’, columntype: ‘textbox’, width: ‘18%’ },
    { text: ‘Note’, datafield: ‘note’, columntype: ‘textbox’, width: ‘51%’ },
    { text: ‘Date’, cellsformat: ‘MM/dd/yyyy HH:mm:ss’, datafield: ‘noteDateTime’, columntype: ‘date’, width: ‘19%’, filtertype: ‘date’ },
    { text: ”, cellsrenderer: PatientNotesGridRenderer, width: ‘12%’ }
    ],
    });
    }

    Regardless of what I try, leaving out the date format ‘, format: ‘MM/dd/yyyy HH:mm:ss” from the datafields, and trying different variations of cells format, I end up with the following each time in the grid cell:
    /Date(1425387835650)/

    date formatting not working #68372

    owen11
    Participant

    any suggestions, thanks!

    date formatting not working #68394

    Dimitar
    Participant

    Hello owen11,

    The datafield format has to be set to the format of the date received from the database, not the one you wish to see in your grid cells (the column cellsformat). Maybe this is the cause of the issue.

    Best Regards,
    Dimitar

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

    date formatting not working #68441

    owen11
    Participant

    Thanks for coming back to me Dimitar, I’ll check it out

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

You must be logged in to reply to this topic.