jqgrid not updating data on reload

前端 未结 3 1584
春和景丽
春和景丽 2020-12-22 04:38

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

jQuery(document).ready(function(){
  jQuery(\"#list\").jqGrid({
    url:\'/do         


        
3条回答
  •  臣服心动
    2020-12-22 04:38

    It seems to me 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;}
    },
    

    UPDATED: In your current solution the value of postData are calculated one time as you create jqGrid. In the postData with functions jqGrid forward postData to jQuery.ajax and during every jQuery.ajax (after $("#list").trigger("reloadGrid");) the values from datepicker will be read at the moment of jQuery.ajax call.

提交回复
热议问题