【发布时间】:2014-07-24 14:54:45
【问题描述】:
我已经完成了针对无法在 SelectRow 上工作但它们无法为我工作的解决方案。
我有以下代码:
$("#myActions_gridTable").jqGrid({
datatype:'local',
data: myActionsData,
cellsubmit: 'clientArray',
cellEdit: true,
rowNum: noOfLinesToDisplay,
pager: $("#myActions_pager"),
sortname: 'contract_Name',
viewrecords: true,
sortorder: 'asc',
autoWidth:true,
loadonce: true,
cmTemplate: { title: false },
height:'auto',
scrollrows: true,
colNames:["id","Status"],
colModel:[
{
name:'id',index:'id', jsonmap:'id', width:1,hidden:true,key:true, editable:true
},
{name:'status',index:'status', align:'center', sortable: false,
editable: true,
edittype: "select",
width: 150,
editoptions: {
value: "1:Done;2:Running"
}
}
],
onSelectRow : function(id){
console.log('inside onSelectRow');
if (id && id !== lastsel) {
$('#myActions_gridTable').restoreRow(lastsel);
$('#myActions_gridTable').editRow(id, true);
lastsel = id;
}
}
});
这里 OnSelectRow 不会被触发,也不会打印 console.log。 请帮忙。
【问题讨论】:
-
奇怪的是你同时使用了
cellEdit: true和editRow(在onSelectRow内部)。你想实现哪个editing mode:单元格编辑还是行编辑?你定义了lastsel变量吗? -
trirand.com/jqgridwiki/doku.php?id=wiki:events 这里的“S”是变量名“lastSel”的大写,这可能是一个原因。您是否发现任何浏览器控制台错误?
-
我不认为这与变量名问题有关.. @BhushanKawadkar
-
@Oleg 没有什么对我有用,所以我只是尝试添加 cellEdit 也是如此。
-
@p.pradnya:您能否将您使用的输入数据包括在内。我觉得奇怪的是您使用
edittype: "select"和editoptions: {value: "1:Done;2:Running"}而没有 使用formatter: "select"。您在输入数据中使用"Done"和"Running"字符串还是1或2?
标签: javascript jquery jqgrid jquery-events jqgrid-formatter