jqGrid重新定位删除确认框 [英] jqGrid Reposition Delete Confirmation Box

查看:84
本文介绍了jqGrid重新定位删除确认框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在将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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆