The problem is that i have made a function that gives back a value for bottominfo.
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;
};
But the function is only called when first load the grid and not every time that i open a form. Is there a way to change bottominfo every time i open a form?
UPDATED 3:
I have that method:
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()});
Is there a problem with the way i call the function?
UPDATED 2
The other properties are not really helpfull for me, so i erased them. The other code is :
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;
}
Probably you should just use recreateForm: true property as additional option of “Add” and “Edit” settings (see here an example). I personally change
$.jgrid.editto userecreateForm: trueas default in all projects which I made for the customers.Additionally you should replace one
;in your code to,because currentlybottominfovariable are undefined and have to be interpreted as global. Some browsers will stop executing of the code in strict mode and interpret the case as an error. So just replaceto
UPDATED: You use
bottominfo: bottominfo()as parameter ofnavGridmethod. So the value for the will be set only once during the call. To be able to have dynamicalbottominfoI can suggest you two ways:1) You can first call
navGridwithadd:false, edit:falseoptions and then use navButtonAdd to add custom buttons which looks like the original “Add” and “Edit” buttons. Inside of theonClickButtoncallback you will get the rowid of currently selected row (getselrowparameter with respect ofgetGridParam) and then call editGridRow with all parameters which you need.2) Alternatively you can set any dummy string as
bottominfoand overwrite it manually to another text manually. The code can be like the followingsee the demo: