I find is not a dupe. On the opposite I find it good so +1 from me.
The jqGrid use internally the method viewModal
($.jgrid.viewModal
) which shows the most dialogs. The method has toTop
parameter, but and delGridRow and editGridRow dosn't use it and it will be set to toTop:true
. So the Add, Edit and Delete dialogs will be displayed always to the top of the grid which can be inside of inviable area.
To fix the problem you can define the afterShowForm event handle which change the dialog position. For example
$("#list").jqGrid('navGrid','#pager', {}, {}, {},
{
afterShowForm: function($form) {
var dialog = $form.closest('div.ui-jqdialog'),
selRowId = myGrid.jqGrid('getGridParam', 'selrow'),
selRowCoordinates = $('#'+selRowId).offset();
dialog.offset(selRowCoordinates);
}
});
In the example the dialog will be placed over the selected row. The code can be improved for the case when the selected row in the last row and the bottom part of the dialog is outside of the window. Nevertheless the above implementation seems me better as the default one because the user see the dialog exactly over the row which he want to delete and he can move the dialog so that it will be full visible.
You can test the suggested movement of the Delete dialog on the live demo.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…