jQWidgets Forums

jQuery UI Widgets Forums Grid columntype: 'datetimeinput' bug ??…

This topic contains 1 reply, has 2 voices, and was last updated by  Peter Stoev 12 years ago.

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

  • tuthmosis
    Member

    Hi Peter,

    Looks like the dates coming from json/mysql are loaded as simple “string” in the grid…

    Only when the user clicks the cell to edit the date does the value becomes a javascript’s date object !!!

    Is this a bug or am i doing something wrong…

    To try to answer this myself i looked at “ALL” of your php/mysql demos in the framework and “NONE” of them exchanges dates with mysql !!!…. Is it because it cannot work ?

    I realized this by debugging the following code:

                   columns: [
    { text: "id", datafield: "id", width: 30},
    { text: "froute_id", datafield: "froute_id", width: 60 },
    { text: "start", cellsformat: 'HH:mm',columntype: 'datetimeinput', datafield: "start", width: 100 ,
    initeditor: function (row, cellvalue, editor)
    {
    editor.jqxDateTimeInput({ showCalendarButton: false });
    },
    validation: function (cell, value)
    {
    var end= $('#jqxgrid').jqxGrid('getcellvalue', $('#jqxgrid').jqxGrid('getselectedrowindex'), "end");
    ...

    When i look at the value for “Start” which is the field the user just edited, it is of type “Date”…
    If i look at the the value for “End” which the user didn’t touch, the type is “String” !!!

    And there is a difference between the way it looks… freshly loaded, the date values formated as HH:mm also shows seconds…
    When clicking a cell to enter in edit mode, without changing the value and by clicking out of editing mode, the value always become “00:00″… even if the original value was “13:00:00”


    Peter Stoev
    Keymaster

    Hi,

    Please, make sure that you initialized the “datafields” array of the source object correctly. Date fields should be initialized with type: ‘date’. It is absolutely necessary to initialize the “datefields” array and each field to have “name” and “type” members.

    In addition, the synchronization with your DB depends only what params you pass to the Ajax function. I do not see a reason why you should not be able to send a Date through Ajax. It does not matter whether the data variable is a Date or Number or String. Just use jQuery’s param function to format your variables as illustrated in our samples.

    Best Regards,
    Peter Stoev

    jQWidgets Team
    http://www.jqwidgets.com

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

You must be logged in to reply to this topic.