Jqgrid does not update data on reboot

I have jqgrid loading data from an xml stream (handled by django 1.1.1):

jQuery(document).ready(function(){
  jQuery("#list").jqGrid({
    url:'/downtime/list_xml/',
    datatype: 'xml',
    mtype: 'GET',
    postData:{site:1,date_start:document.getElementById('datepicker_start').value,date_end:document.getElementById('datepicker_end').value},
    colNames:[...],
    colModel :[...],
    pager: '#pager',
    rowNum: 25,
    rowList:[10,25,50],
    viewrecords: true,
    height: 500,
    caption: 'Click on column headers to reorder'
  });

    $("#grid_reload").click(function(){
        $("#list").trigger("reloadGrid");
        }); 
    $("#tabs").tabs();

    $("#datepicker_start").datepicker({dateFormat: 'yy-mm-dd'});
    $("#datepicker_end").datepicker({dateFormat: 'yy-mm-dd'});
...

And the html elements:

<th>Start Date:</th>
<td><input id="datepicker_start" type="text" value="2009-12-01"></input></td>
<th>End Date:</th>
<td><input id="datepicker_end" type="text" value="2009-12-03"></input></td>
<td><input id="grid_reload"  type="submit" value="load" /></td>

When I click the grid_reload button, the grid reboots, but when it does, it shows exactly the same data as before, even if the xml is checked to return different data for different timestamps.

I checked with alert (document.getElementById ('datepicker_start').) That the values ​​in the date entries are passed correctly when the reload event fires.

Any ideas why the data is not being updated? Perhaps a caching or browser issue?

+1
source share
3 answers

I think you should replace

postData:{
    site:1,
    date_start:document.getElementById('datepicker_start').value,
    date_end:document.getElementById('datepicker_end').value
},

with

postData:{
    site:1,
    date_start: function() { return document.getElementById('datepicker_start').value; },
    date_end: function() { return document.getElementById('datepicker_end').value;}
},

: postData jqGrid. postData jqGrid postData jQuery.ajax jQuery.ajax ( $("#list").trigger("reloadGrid");) datepicker jQuery.ajax.

+3

. IE GET. , , URL-, (IE, ).

jqGrid jQuery.ajax . jqGrid ajax ajaxGridOptions. , , :

jQuery("#list").jqGrid({
    ...
    ajaxGridOptions: {cache: false}
});

:

django - URL- GET ( jQuery ?), . :

  • GridUnload, ,
  • .jqGrid,
  • url, , URL- , .

, , .

+2

Unloading the grid before making a new request seems to force me to use the cache. Simple GridUnload () method before retrieving the grid code.

$("#list").GridUnload();


jQuery("#list").jqGrid({
    ...
    ajaxGridOptions: {cache: false}
});
+2
source

All Articles