我认为你有两个选择。我个人通过定义我自己的自定义编辑选项来处理这个要求。
前任:
...
editable: true, edittype: 'custom', editoptions: { custom_element: readOnlyTextBox, custom_value: readOnlyTextBoxValue }
...
function readOnlyTextBox(value, options) {
var el = document.createElement("input");
el.type = "text";
el.value = value;
el.disabled = true; // "disabled";
return el;
} //function readOnlyTextBox(value, options) {
function readOnlyTextBoxValue(elem, operation, value) {
//console.log('Elem: ' + elem + ' Operation: ' + operation + ' Passed Value: ' + value + ' Value: ' + $(elem).val());
if (operation === 'get') {
return $(elem).val();
} else if (operation === 'set') {
$(elem).val(value);
}
} //function readOnlyTextBoxValue(elem, operation, value) {
另一种选择是定义您自己的编辑表单处理程序并传入额外的行项值:
....
ondblClickRow: function (rowid) {
EditCollectionItem(rowid, this)
}, //ondblClickRow
....
function EditCollectionItem (rowid, grid){
$(grid).jqGrid('editGridRow', rowid,
{
viewPagerButtons: false,
editData: { ExtraDataKey: ExtraDataValue },
afterShowForm: function (formid) {
}, //afterShowForm
afterComplete: function (response) {
} //afterComplete
}); //$this.jqGrid('editGridRow
}//function EditCollectionItem (rowid, grid){