我有一个jqgrid导航器,可将网格导出到csv。
$('#jqgEndYear').jqGrid('navGrid', '#jqgpEndYear',
{ excel: true, add: false, del: false, edit: false, search: false },
{}, {}, {});
$("#jqgEndYear").jqGrid('navButtonAdd', '#jqgpEndYear', {
caption: "",
onClickButton: function () {
alert(mapping);
$.post('@Url.Action("ExportEndYearSummaryToCsv")', {
clientId: '@Model.Division.Client.ClientID',
globalId: '@Model.GlobalId',
firstName: '@Model.FirstName',
lastName: '@Model.LastName',
mapping: mapping,
yearEnd: year
}, function (data) {
window.location.href = data;
});
}
});
提交表单时填充我的jqGrid。
$('#reviewButton').click(function () {
var year = $('#YearList').val();
var mapping = $.trim($('#MappingList').val());
if (!firstClick) {
var postdata = $("#jqgEndYear").jqGrid('getGridParam', 'postData');
postdata.yearEnd = year;
postdata.mapping = mapping;
$("#jqgEndYear").trigger("reloadGrid");
}
else {
firstClick = false;
$('#jqgEndYear').jqGrid({
//url from wich data should be requested
url: '@Url.Action("YearEndReview")',
//type of data
datatype: 'json',
//url access method type
mtype: 'POST',
postData: { mapping: mapping, yearEnd: year, clientId: '@Model.Division.Client.ClientID', globalId: '@Model.GlobalId' },
....
}
由于导航器是在第一次点击时定义的,如果我再次提交表单,“映射”和“年份”的值仍然是导出帖子中的旧值。
我该如何解决这个问题?
提前致谢