在我的jqGrid中,我正在使用内联编辑和表单编辑。
我的其中一个列不应该在内联编辑中可编辑,因此我将attribut editable在我的colModel中设置为false,但此列应在表单编辑中可见(编辑时只读,添加时可编辑)。
以下是我的尝试:
colModel:[{name:'bordereau',index:'BORDEREAU',width:60,align:'center',title:false,editable:false,editoptions: { readonly: true },editrules:{required:true},sortable:true,search:true},
function addRowForm(){
grid.editGridRow("new",{
width:'auto',
height:'auto',
reloadAfterSubmit:true,
recreateFilter:true,
beforeInitData: function() {
grid.jqGrid('setColProp','bordereau',{editable:true});
grid.jqGrid('setColProp','bordereau',{editoptions: {readonly: false}});
},
afterShowForm: function() {
$("#editmod"+gridId).css("top",Math.round(((hauteurFenetreUtilisable)/2)-($("#editmod"+gridId).height()/2))+"px");
$("#editmod"+gridId).css("left",Math.round(((largeutFenetreUtilisable)/2)-($("#editmod"+gridId).width()/2))+"px");
grid.jqGrid('setColProp','bordereau',{editable:false});
grid.jqGrid('setColProp','bordereau',{editoptions: {readonly: true}});
$("#TblGrid_listeVar2 tr:visible:odd").addClass("jqgrow ui-row-ltr odd");
},
onclickPgButtons : function (which, formid, numeroBordereau) {
},
onClose: function() {
},
afterComplete: function() {
}
});
}
function editRowForm(numeroBordereau){
grid.restoreRow(numeroBordereau);
resetGridVar();
grid.editGridRow(numeroBordereau,{
width:'auto',
height:'auto',
reloadAfterSubmit:true,
recreateFilter:true,
beforeInitData: function() {
grid.jqGrid('setColProp','bordereau',{editable:true});
},
afterShowForm: function() {
$("#editmod"+gridId).css("top",Math.round(((hauteurFenetreUtilisable)/2)-($("#editmod"+gridId).height()/2))+"px");
$("#editmod"+gridId).css("left",Math.round(((largeutFenetreUtilisable)/2)-($("#editmod"+gridId).width()/2))+"px");
$("#TblGrid_listeVar2 tr:visible:odd").addClass("jqgrow ui-row-ltr odd");
grid.jqGrid('setColProp','bordereau',{editable:false});
},
onclickPgButtons : function (which, formid, numeroBordereau) {
},
onClose: function() {
},
afterComplete: function() {
}
});
}