我正在使用 jqGrid v3.8.1,并且无法使用预定义的格式化程序“操作”传递额外的参数。基本上我想在编辑和删除时传递两个参数以及编辑的字段。根据文档,extraparam 可用于将附加参数发布到服务器。我已经尽我所能尝试并尽可能多地进行研究,但是我仍然无法让它发挥作用。我提到了以下内容:
和其他人在stackoverflow和其他地方。我不确定出了什么问题。
以下是我的代码。请帮帮我。
jQuery("#configGrid").jqGrid({
mtype: "post",
url: '/Controller/Action',
datatype: "json",
colNames: ['Location', 'S_No', 'S_C', 'D_No', 'D_C', 'B_No', 'B_C', 'G_No', 'GP_P', 'IP', 'OA', 'NA', 'Months', 'Edit'],
colModel: [{
name: 'name',
index: 'name',
width: 90
}, {
name: 's_no',
index: 's_no',
width: 90,
align: "center",
editable: false
}, {
name: 's_c',
index: 's_c',
width: 90,
align: "center",
editable: true
}, {
name: 'd_no',
index: 'd_no',
width: 90,
align: "center",
editable: false
}, {
name: 'd_c',
index: 'd_c',
width: 90,
align: "center",
editable: true
}, {
name: 'b_no',
index: 'b_no',
width: 90,
align: "center",
editable: false
}, {
name: 'b_c',
index: 'b_c',
width: 90,
align: "center",
editable: true
}, {
name: 'g_no',
index: 'g_no',
width: 100,
align: "center",
editable: false
}, {
name: 'g_c',
index: 'g_c',
width: 100,
align: "center",
editable: true
}, {
name: 'TIP',
index: 'TIP',
width: 80,
align: "right",
editable: true
}, {
name: 'OA',
index: 'OA',
width: 80,
align: "center",
editable: true
}, {
name: 'NA',
index: 'NA',
width: 80,
align: "center",
editable: true
}, {
name: 'Months',
index: 'Months',
width: 150,
align: "center",
sortable: false,
editable: true
}, {
name: 'myac',
width: 50,
align: "center",
fixed: true,
sortable: false,
resize: false,
formatter: 'actions',
formatoptions: {
keys: true,
extraparam: {
slot: "1",
installment: "1"
}
}
}],
rowNum: 10,
rownumbers: true,
autowidth: true,
rowList: [10, 20, 30],
postData: {
level: function () {
if (p_level == undefined || p_level == null) {
return 'S';
} else {
return p_level;
}
},
location: function () {
return p_location;
},
ownLower: function () {
return flagOwnLower;
},
slot: function () {
return $("#ddlSlot").val();
},
installment: function () {
return $("#ddlInstallment").val();
}
},
loadError: function (xhr, status, error) {
$('#ErrorMessage').html(xhr.responseText);
$('#ui-widget').show();
$("#ErrorMessage").stop().show('slow');
},
//loadonce: true,
pager: '#configPager',
sortname: 'invdate',
viewrecords: true,
sortorder: "desc",
//jsonReader: { repeatitems: false },
caption: "caption",
height: '100%',
editurl: '/Controller/UpdateAction/' + Math.random(),
multiselect: true,
loadComplete: function () {
$('#ErrorMessage').html("");
$('#ui-widget').hide();
$("#ErrorMessage").stop().hide('slow');
gridLoaded = true;
},
onSelectRow: function (rowId) {
//tried this but it is not working
//jQuery("#frmac").editRow(rowId, true, null, null, '/Action/Controller/' + Math.random(), { slot: $("#ddlSlot").val(), installment: $("#ddlInstallment").val() });
}
});