jQWidgets Forums

Forum Replies Created

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • in reply to: Possible bug related to addrow Possible bug related to addrow #46615

    DaveB
    Participant

    also, I ran this in version 3.0.1 on both IE 8 and Firefox 25


    DaveB
    Participant

    One last follow up on this question. What would be the recommended best practice in this situation? JQWidgets does what I would expect, but when I convert the data back to JSON via stringify the times are converted to GMT time instead of the time that was in the grid. I suppose I could send the timezone offset back to the server and update the dates when I process them, but that is a little ugly. Searching google I haven’t found an alternative to stringify that would give me the date in the local time instead of GMT.


    DaveB
    Participant

    Actually it looks like this is not a JQWidgets issue at all. The issue is that when I call JSON.stringify it will convert the dates to GMT dates instead of the local datetime.


    DaveB
    Participant

    Looking deeper into this I don’t think this has anything to do with the timezone, rather I believe this is a bug. If I change the line where the shippedDate is set in the array to the code below it shows as 2013-08-24 09:12:17AM in the grid as you would expect, but when you export the grid to JSON it is still off by four hours [{“shippedDate”:”2013-08-24T13:12:17.000Z”,”shipName”:”test”,”uid”:0}]. Its almost as if it is trying to adjust the timestamp to some other timezone. Remember, in this example now there is no other timezone or server, everything is on my machine.

    var shippedDate =
    [
    "2013-08-24 09:12:17AM"
    ];

    DaveB
    Participant

    ok, but when it comes down from the server and the grid renders it correctly, shouldn’t it send back the same value correctly as well? The grid seems to be smart enough to figure that out, as in the example, the grid shows the date 2013-08-24 08:11:09PM, which is correct, but when I click the JSON which exports the date to JSON the resulting date is [{“shippedDate”:”2013-08-25T00:11:09.000Z”,”shipName”:”test”,”uid”:0}], which is four hours off. I am a little confused as to how I can handle this.


    DaveB
    Participant

    That may be the issue as my server is passing in a format that I am not familiar with (the date comes in a numeric format). I have an example below that illustrates my issue. The grid produce the correct result from the data source, however, when I convert it to JSON by hitting the JSON button the resulting JSON string is off by a four hours. Possibly the number format have the timezone built in and when it is exported it is using the local timezone? If it makes any difference I am using JQWidgets 2.8.3.

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title id='Description'>This example shows how to enable sorting and sort by a column.
    </title>
    <link rel="stylesheet" href="../../jqwidgets/styles/jqx.base.css" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcore.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdata.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxbuttons.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxscrollbar.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxmenu.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.sort.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.filter.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxgrid.selection.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxpanel.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxcheckbox.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxlistbox.js"></script>
    <script type="text/javascript" src="../../jqwidgets/jqxdropdownlist.js"></script>
    <script type="text/javascript" src="../../scripts/gettheme.js"></script>
    <script type="text/javascript">
    $(document).ready(function () {
    var theme = getDemoTheme();
    // prepare the data
    var data = new Array();
    var shippedDate =
    [
    "1377389469000"
    ];
    var shipName =
    [
    "test"
    ];
    var row = {};
    row["shippedDate"] = shippedDate;
    row["shipName"] = shipName;
    data[0] = row;
    // prepare the data
    var source =
    {
    localdata: data,
    datatype: 'array',
    datafields: [
    { name: 'shippedDate', type: 'date' },
    { name: 'shipName', type: 'string', format: 'yyyy-MM-dd hh:mm:sstt' },
    ],
    id: 'id',
    data: data
    };
    var dataAdapter = new $.jqx.dataAdapter(source);
    // create jqxgrid.
    $("#jqxgrid").jqxGrid(
    {
    width: 670,
    height: 450,
    source: dataAdapter,
    theme: theme,
    altrows: true,
    columns: [
    { text: 'Ship Name', datafield: 'shipName', width: 250 },
    { text: 'Shipped Date', datafield: 'shippedDate', width: 200, cellsformat: 'yyyy-MM-dd hh:mm:sstt' }
    ]
    });
    $('#events').jqxPanel({ width: 300, height: 80, theme: theme });
    $('#jsonbutton').jqxButton({ height: 25, theme: theme });
    $('#jsonbutton').click(function () {
    var jsonObj = $('#jqxgrid').jqxGrid('getrows');
    alert(JSON.stringify(jsonObj));
    });
    });
    </script>
    </head>
    <body class='default'>
    <div id='jqxWidget' style="font-size: 13px; font-family: Verdana; float: left;">
    <div id="jqxgrid">
    </div>
    <div id="eventslog" style="margin-top: 30px;">
    <div style="float: left; margin-right: 10px;">
    <input value="JSON" id="jsonbutton" type="button" />
    <div style="margin-top: 10px;" id='sortbackground'>Sort Background</div>
    </div>
    <div style="margin-left: 100px; float: left;">
    Event Log:
    <div style="border: none;" id="events">
    </div>
    </div>
    </div>
    </div>
    </body>
    </html>

    DaveB
    Participant

    fyi, this turned out not to be an issue. The problem was caused elsewhere in the code by improperly making beginupdate/endupdate calls in my code.


    DaveB
    Participant

    I don’t think that is correct. If you go to any of your editing demos, go into edit mode on a cell and then type in the example button tag below and tab off of the field, when you leave the cell a button will be visible in the cell.

    <button>TEST</button>
    in reply to: Bug with version 2.9 Bug with version 2.9 #23899

    DaveB
    Participant

    Peter, I’m not ready to call it a bug yet, but I do see a similar behavior that Marco reported when upgrading from 2.8.3. A number of grids show loading, but never load. Other ones do load, but do not render correctly (it appears as if the row data is all showing in the first column with the columns overlaying each other). I will look into it further to see if it is something that can be corrected easily, but I did want to bring it to your attention that this may not be an isolated issue. I only upgraded it yesterday and didn’t spend any time on it after the upgrade, so I will keep you posted.


    DaveB
    Participant

    In my case, the effect of the button will vary based on the value of the Drop Down column. To the user, it appears that they have changed the value after selecting it from the dropdown, but the button will behave incorrectly because the new values have not yet been accepted (this is probably also the case for edit columns). Is there a way to force the changes to be accepted? Could I trigger the cellendedit event maybe to force the change to process before, possibly at the beginning of the buttonclick? Maybe even a generic accepttext type of event that would cause any existing cells that have focus to lose focus (or behave as if they had lost focus?


    DaveB
    Participant

    Thank you Peter, that was exactly what I was looking for.


    DaveB
    Participant

    also, if you need an example, you can use the Key/Values example and just add a couple of employees to the employee.xml file. Currently they all show in the drop down because the IDs for those employees also exist in the orders xml, but any employees that do no exist in the orders.xml will not display in the drop down.


    DaveB
    Participant

    Huge difference! Thanks you, keep up the great work on this project!

    in reply to: making a column non-editable making a column non-editable #19768

    DaveB
    Participant

    Hi Peter, similar question. Would you have an example of setting this property after the Grid has already been created? I am having trouble finding the API to change the editable attribute for a column when it is not part of the create block.


    DaveB
    Participant

    ok, thank you. I’ll keep my eye out for the enhancement in future versions.

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