0
jqGrid工具欄和內聯刪除按鈕用於刪除行。如何在jqgrid中刪除後將焦點設置爲網格
顯示刪除命令刪除對話框。刪除確認或取消後,網格將不會獲得焦點。鼠標在網格中單擊需要使鍵盤導航才能在網格中工作。
如何在刪除後將焦點設置爲網格,或者如果刪除被取消,因此不需要額外的鼠標點擊?在工具欄
刪除按鈕:在列
$.extend($.jgrid.del, {
top: window.innerHeight/2-100,
left: window.innerWidth/2-120,
closeOnEscape: true,
errorTextFormat: function (response) {
clearModeless();
return decodeErrorMessage(response.responseText, '', '');
},
reloadAfterSubmit: false,
afterShowForm: function($form) {
var form = $form.parent()[0];
$("#dData",form).attr("tabindex","1000");
$("#eData",form).attr("tabindex","1001");
setTimeout(function() {
$("#dData",form).focus();
},50);
}
});
$grid.jqGrid("navGrid", "#grid_toppager", {
search: true,
del: true,
add: true,
view: true,
edit: true
},
{ url: '/erp/Grid/Edit?_entity=Klient'},
{ url: '/erp/Grid/Add?_entity=Klient' },
{ url: '/erp/Grid/Delete?_entity=Klient',
beforeShowForm: function(form) {
var selected = $grid.jqGrid('getGridParam','selarrrow');
$("td.delmsg",form).html('Rows '+selected.length +'<br/>' +
'Delete?');
}
}
);
刪除按鈕:」
colModel: [{"name":"_actions","formatter":"actions","viewable":false,"formatoptions":{"editbutton":true,"keys":true,"onSuccess":function (jqXHR) { jqXHRFromOnSuccess=jqXHR;return true;}
,"afterSave":function (rowId) {
var data = $.parseJSON(jqXHRFromOnSuccess.responseText);
$grid.jqGrid('setRowData', rowId, { Kood: data.PrimaryKeyValues[0] });
cancelEditing($grid);afterGridSaveFunc(rowId,jqXHRFromOnSuccess);jqXHRFromOnSuccess=null;
updateButtonState($grid);
}
,"restoreAfterError":false,"onError":errorfunc
,"extraparam":{"_dokdata":FormData
},"afterRestore":function() {
updateButtonState($grid);
}
,"onEdit":onInlineEdit
,"delbutton":true,"delOptions":{"url":"Delete","afterComplete":function (response, postdata, formid) { summarefresh($grid); }
}}},
我添加'afterComplete:function(){alert('afterComplete'); $ grid [0] .focus();}'刪除選項。如果按Esc鍵或取消按鈕刪除問題,消息框不會出現,按鍵不起作用。如何在刪除已取消後將焦點設置回柵格? – Andrus 2012-04-08 08:04:54
此外,如果服務器從刪除控制器返回錯誤並按下取消,鍵將不起作用。 ''grid [0] .focus()'只將焦點設置爲網格。使用'multiselect:true'。如何將焦點設置到最近的已刪除行或第一行,以便上/下箭頭鍵在刪除後移動到文本/上一行? – Andrus 2012-04-08 08:15:06