【发布时间】:2012-03-14 08:48:41
【问题描述】:
问题是我已经创建了一个函数,它返回一个底部信息的值。
var bottominfo = function (){
var vMonth = document.getElementById('cmb_Month').value;
var vYear = document.getElementById('Year').value;
var StartDate = firstdayofmonth(vMonth, vYear);
var EndDate = lastdayofmonth(vMonth, vYear);
var next=getnext(StartDate,EndDate);
var bottominfo='You are going to add'+next;
alert(bottominfo);
return bottominfo;
};
但该函数仅在首次加载网格时调用,而不是每次打开表单时调用。有没有办法在每次打开表单时更改底部信息?
更新 3: 我有那个方法:
jQuery(list).jqGrid('navGrid',pager,{edit:true},
{
width:colwidth*1.05,
height:"auto",
reloadAfterSubmit:true,
closeAfterAdd: true,
recreateForm: true,
drag: false,
onClose: after,
bottominfo: bottominfo()});
我调用函数的方式有问题吗?
更新 2
其他属性对我没有帮助,所以我删除了它们。另一个代码是:
function firstdayofmonth(vMonth, vYear){
return vYear+'-'+vMonth+'-01';
}
function lastdayofmonth(vMonth, vYear){
var myDate=new Date();
var vMonth=parseInt(vMonth)+2;
var vYear=parseInt(vYear);
if (vMonth>12)
{vYear=vYear+1;
vMonth=vMonth-12;}
myDate.setFullYear(vYear, vMonth, 0);
return myDate.getFullYear()+'-'+(myDate.getMonth()+1)+'-'+myDate.getDate();
}
var nextprogram=0;
function getnext(StartDate,EndDate) {
next="Applications between"+StartDate+"and"+EndDate;
return next;
}
【问题讨论】: