jqGrid 重新定位删除确认框 [英] jqGrid Reposition Delete Confirmation Box
问题描述
我目前正在使用 jqGrid 和 navGrid,del 设置为 true.问题是当用户单击删除时,它会在网格的左上角弹出一个确认框.由于我们已经向下滚动到最底部,我的高度很大,因此用户必须一直走到顶部才能确认.有什么办法可以移动这个位置吗?手动偏移就好了,但理想情况下我想将它停靠在左下角,与左上角相对.
I am currently using jqGrid with the navGrid, del set to true. Problem is when a user clicks on delete, it pops up a confirmation box in the upper left hand of the grid. Since we are already scrolled down to the very bottom, which i have a large height, the user has to go all the way to the top to confirm. Is there any way to move the position of this? A manual offset is just fine, but ideally i want to dock it to the bottom left, as apposed to top left.
提前致谢
(如果这是一个骗局,我很抱歉.我只是尝试发布它,但它给了我一些奇怪的错误,并且没有显示在我的历史记录中,所以假设它没有发布.)
(If this is a dupe I am sorry. I tried just posting it but it gave me some weird error and is not showing in my history so assumed it did not post.)
推荐答案
我发现不是骗子.相反,我觉得它很好,所以我 +1.
I find is not a dupe. On the opposite I find it good so +1 from me.
jqGrid 在内部使用方法 viewModal
($.jgrid.viewModal
) 显示最多的对话框.该方法有 toTop
参数,但是和 delGridRow 和 editGridRow 不使用它将被设置为 toTop:true
.因此,添加、编辑和删除对话框将始终显示在网格的顶部,可以在不活动区域内.
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.
要解决此问题,您可以定义 afterShowForm 改变对话框位置的事件句柄.例如
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.
您可以在 现场演示一个>.
这篇关于jqGrid 重新定位删除确认框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!