我正在尝试在jqgrid中实现表单编辑。我从服务器端加载json数据。一切顺利。但是当我尝试使用编辑按钮进行编辑时。它显示“请,选择行”警告。删除和查看相同的错误,但添加工作正常。我甚至试过onClickrow editform。但我的表格不会弹出。有什么想法??
以下是我的代码
var insptrackgrid = $("#insptracktbl");
insptrackgrid.jqGrid({ //17 cols
datatype: "json",
url:"/Myelclass/InspectionTrackAction.do?event=load",
colNames:['ID','Status','CtNo','InspDate','QCtlr','ArticleID','Article','Color','InspCdn','testID','GradeId','RejID','TotInspctd','comments'],
colModel :[
{name: 'inspid', index: 'inspid', align:'center', width:60, editable: true, sortable: true, hidden: false,
},
{name: 'status', index: 'status', align:'center', width:60, editable: true, sortable: true, hidden: false,
},
{name: 'inspContractNo', index: 'contractno', align:'center', width:60, editable: true, sortable: true, hidden: false,
},
{name: 'inspdate', index: 'inspdate', align:'center', width:60, editable: true, sortable: true, hidden: false,
},
{name: 'inspqualityctrlr', index: 'qualitycontroller', align:'center', width:60, editable: true, sortable: true, hidden: false,
},
{name: 'articleid', index: 'articleid', align:'center', width:60, editable: true, sortable: true, hidden: false,
},
{name: 'article', index: 'article', align:'center', width:60, editable: true, sortable: true, hidden: false,
},
{name: 'color', index: 'color', align:'center', width:60, editable: true, sortable: true, hidden: false,
},
{name: 'inspcdn', index: 'inspcdn', align:'center', width:60, editable: true, sortable: true, hidden: false,
},
{name: 'testid', index: 'testid', align:'center', width:60, editable: true, sortable: true, hidden: false,
},
{name: 'gradeid', index: 'gradeid', align:'center', width:60, editable: true, sortable: true, hidden: false,
},
{name: 'rejectsid', index: 'rejectsid', align:'center', width:60, editable: true, sortable: true, hidden: false,
},
{name: 'totinspected', index: 'totinspected', align:'center', width:60, editable: true, sortable: true, hidden: false,
},
{name: 'inspcomments', index: 'inspcomments', align:'center', width:60, editable: true, sortable: true, hidden: false,
},
],
jsonReader : {
repeatitems: false,
root: "rows",
page: "page", //calls first
total: "total" ,//calls Second
records: "records" //calls Third
},
caption: "Inspection Tracking Report",
pager: "#insptrackpager",
rowNum: 10,
rowList:[20,30,40],
loadtext: "Bow Bow",
height : "auto",
width:"auto",
sortname: "contractno",
sortorder: "desc",
viewrecords: true,
gridview: true,
editurl:"/Myelclass/InspectionTrackAction.do?event=edit",
emptyrecords: "No records to display",
/*onSelectRow: function () {
alert("rows selected");
},*/
ondblClickRow: function(rowid) {
alert("Double Click ");
$(this).jqGrid('editGridRow', rowid); // this never Called
alert("Double Click 2");
},
});
insptrackgrid.jqGrid('navGrid','#insptrackpager',{
edit: true,
add: true,
del: true,
search: true,
view: true,
});
我正在为ref添加两张图片。 图1显示了加载的数据 图2显示了选择要编辑的数据。在这里我选择了ID = 4进行编辑
答案 0 :(得分:0)
在ondblClickRow
功能中,将editGridRow
行更改为:
insptrackgrid.jqGrid('editGridRow', rowid);
这有帮助吗?