【发布时间】:2014-08-29 05:59:44
【问题描述】:
我正在使用 jqGrid 和 OnSelectRow 函数来编辑网格中的一行。当我在行上选择时,我选择的单元格将获得焦点,在 Firefox 上,当我尝试单击同一行中的另一个单元格时,它不会绘制焦点。我要么需要选择它,要么选择我们的行并返回到它。
它在 Chrome 中运行良好。
代码如下:
gridElement.jqGrid({
url: $.url("/MyURL"),
postData: {
ID: function () { return $('#IDVAL').val(); }
},
datatype: "json",
mtype: "POST",
colNames: ['Name', 'Numbers', 'Options', 'TextBox', 'Hide'],
colModel: [
{ name: 'Name', index: 'Name', width: 200, hidden: false },
{ name: 'Numbers', index: 'Type', width: 120, editable: true, edittype: "select", editoptions: { value: { 0: 'None', 1: 'One', 2: 'Two' }, dataInit: function (elem) { $(elem).width(85); } } },
{ name: 'Options', index: 'Summary', width: 120, editable: true, edittype: "select", editoptions: { value: { 0: 'None', 1: 'Option 1', 2: "Option 2" }, dataInit: function (elem) { $(elem).width(85); } } },
{ name: 'TextBox', index: 'TextBox', width: 300, edittype: "text", editable: true, editoptions: { size: "50", maxlength: "100"} },
{ name: 'Hide', index: 'Hide', width: 80, editable: true, edittype: "checkbox", editoptions: { value: "true:false"} }
],
rowNum: 50,
width: 800,
height: "auto",
loadtext: "Please wait...",
viewrecords: true,
hidegrid: false,
onSelectRow: function (id) {
if (id && id !== lastselref) {
gridElement.saveRow(lastselref, false, 'clientArray', '');
gridElement.jqGrid('restoreRow', lastselref);
gridElement.jqGrid('editRow', id, true);
lastselref = id;
}
},
forceFit: true
});
【问题讨论】: