jQWidgets Forums

jQuery UI Widgets Forums Editors DateTimeInput how to display the date value in the format YYYY-MM-DD in the jqxgrid

This topic contains 14 replies, has 2 voices, and was last updated by  Peter Stoev 11 years, 11 months ago.

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author

  • ssp
    Participant

    Hi,,

    I have to obtain the date value from the database which is given in the format YYYY-MM-DD and display in the jqxgrid in the same format,,,

    I have used the following code:

    text : ‘Start Date’, id: ‘startDatePopUp’,datafield : ‘startDate’, columntype: ‘datetimeinput’,   cellsformat: ‘MMM yyyy’, align : ‘center’, width : 150, cellsalign : ‘center’,

    but it is being displayed in the grid as YYYY-MM-DD 00:00:00.0

    how will I display the date value in the format YYYY-MM-DD in the jqxgrid??

    Thanks & Regards,

    ssp


    Peter Stoev
    Keymaster

    Hi,

    The cellsformat specifies the display format in the Grid. In the posted code it is ‘MMM yyyy’, not ‘yyyy-MM-dd’. In addition, make sure that the datafield’s type property is set to “date” during the datafields array initialization in the source object.

    Best Regards,
    Peter Stoev

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


    ssp
    Participant

    Hi,

    I get the same display format i.e. YYYY-MM-DD 00:00:00.0 even after changing the cellsformat:

    text : ‘Start Date’, id: ‘startDatePopUp’,datafield : ‘startDate’, columntype: ‘date’, cellsformat: ‘yyyy-MM-dd’, align : ‘center’, width : 150, cellsalign : ‘center’,

    tried with both columntype: ‘date’ and columntype: ‘datetimeinput’

    Do you mean datafields array initialization in the database:
    in my oracle db, the initialization is Date and is in the Date format only without having any time values….

    Thanks & Regards,

    ssp


    Peter Stoev
    Keymaster

    Hi,

    I meant the datafields initialization in the source object which you pass to the jqxDataAdapter plug-in.

    Best Regards,
    Peter Stoev

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


    ssp
    Participant

    Hi,

    I have set the datafields initialization in the following way,

    var milestone =
    {
    datatype: “json”,
    datafields: [
    { name: ‘milestoneType’, type: ‘string’},
    { name: ‘phase’, type: ‘string’},
    { name: ‘phaseDescription’, type: ‘string’},
    { name: ‘customPhase’, type: ‘string’},
    { name: ‘startDate’, type: ‘date’},
    { name: ‘endDate’, type: ‘date’}

    ],
    cache: false,
    url: ‘milestoneJCI.htm’

    };

    .
    .
    .
    initeditor: function (row, cellvalue, editor) {
    editor.jqxDateTimeInput(‘setDate’, new Date());
    }

    Thanks & Regards,

    ssp


    ssp
    Participant

    Hi,

    Sorry I forgot to mention, though I am initializing the property of Date column as type: ‘date’,
    I am not able to remove the timestamp values from the Date : YYYY-MM-DD 00:00:00.0

    I have set the datafields initialization in the following way,

    var milestone =
    {
    datatype: “json”,
    datafields: [
    { name: ‘milestoneType’, type: ‘string’},
    { name: ‘phase’, type: ‘string’},
    { name: ‘phaseDescription’, type: ‘string’},
    { name: ‘customPhase’, type: ‘string’},
    { name: ‘startDate’, type: ‘date’},
    { name: ‘endDate’, type: ‘date’}

    ],
    cache: false,
    url: ‘milestoneJCI.htm’

    };

    .
    .
    .
    initeditor: function (row, cellvalue, editor) {
    editor.jqxDateTimeInput(‘setDate’, new Date());
    }

    Please let me know how can I display only the Date in the grid in the format : YYYY:MM:DD ???

    Thanks & Regards,

    ssp


    ssp
    Participant

    Hi,

    How to display Date in the grid cell in the format YYYY-MM-DD?

    because in ,
    text : ‘Start Date’, id: ‘startDatePopUp’,datafield : ‘startDate’, columntype: ‘date’, cellsformat: ‘yyyy-MM-dd’, align : ‘center’, width : 150, cellsalign : ‘center’,

    the cellFormat doesn’t work for any of the formats in the grid other than the YYYY-MM-DD 00:00:00.0

    Thanks & Regards,

    ssp


    ssp
    Participant

    Hi,

    If the width size of the grid cell is reduced, those timestamp wont be shown,

    but I am supposed to truncate those timestamp values without changing the width size from 150!

    How can it be done??

    Thanks & Regards,

    ssp


    Peter Stoev
    Keymaster

    Hi,

    – Could you please, provide a complete sample which illustrates the behavior?
    – Could you share with us which version of jQWidgets you use and which browser do you use?

    Best Regards,
    Peter Stoev

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


    ssp
    Participant

    Hi Peter,
    Thanks for the reply!
    I am using the version ‘jquery-1.7.2.min.js’, and the browser which I am currently using is IE9.

    The sample of my snippet goes as follows:

    var milestone =
    {
    datatype: “json”,
    datafields: [
    { name: ‘milestoneType’, type: ‘string’},
    { name: ‘phase’, type: ‘string’},
    { name: ‘phaseDescription’, type: ‘string’},
    { name: ‘customPhase’, type: ‘string’},
    { name: ‘startDate’, type: ‘date’},
    { name: ‘endDate’, type: ‘date’}

    ],
    cache: false,
    url: ‘milestoneJCI.htm’
    };

    var dataAdapter = new $.jqx.dataAdapter(milestone);
    $(“#milestoneGridForJCI”).jqxGrid(
    {
    width : 900,
    height : 227,
    source : dataAdapter,
    theme : theme,
    editable : true,
    showstatusbar : true,
    statusbarheight : 00,
    showaggregates : true,
    selectionmode : ‘multiplecellsadvanced’,
    columns : { text: ‘Start Date’, datafield: ‘startDate’, columntype: ‘datetimeinput’, width: 150, cellsalign: ‘center’, cellsformat: ‘MMM yyyy’,
    validation: function (cell, value) {
    var flag = dateValidation(cell,value,”Start Date”);
    return flag;
    },
    initeditor: function (row, cellvalue, editor) {
    editor.jqxDateTimeInput(‘setDate’, new Date());

    }

    },]


    Peter Stoev
    Keymaster

    Hi,

    – I did not understand which version of jQWidgets do you use?
    – I still cannot test that code because it does not have any data for testing. The provided code will display an Empty Grid. I am afraid that I cannot test a Date parsing without sample data.

    Best Regards,
    Peter Stoev

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


    ssp
    Participant

    Hi Peter,

    The jqWidgets version I am using currently is 2.7.0.
    The same code which i posted earlier, when I test in GOOGLE CHROME, the date is being displayed in the required format which I want, without timestamp such as ‘Jul 2013’. But the same snippet is not working in IE9. So, I guess this is browser issue. I want the same format ‘Jul 2013’ to be displayed in IE9 as well.


    Peter Stoev
    Keymaster

    Hi,

    That version is no longer actual. The reason behind releasing new versions is that we do fixes and improvements in jQWidgets. The current version is 2.9.2 and I suggest you to upgrade to it in case you wish from us to test something.

    Best Regards,
    Peter Stoev

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


    ssp
    Participant

    Peter,

    I upgraded the version to 2.9.2, but the condition hasn’t changed,
    i.e I get timestamp values appending the date in IE9, whereas in GOOGLE CHROME only ‘MMM yyyy’ is displayed properly!!


    Peter Stoev
    Keymaster

    Hi,

    Ok, then could you provide us a Full Sample which demonstrates your scenario, not just part of the code. Otherwise, we will not be able to help. In addition, if you just upgraded to 2.9.2, then make sure you cleared your browser’s history, before testing again.

    Best Regards,
    Peter Stoev

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

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

You must be logged in to reply to this topic.