为什么 FireFox 和 IE 的 jqgrid Subgrid navButtonAdd Custom Button 错误会发生?

发布于 2024-12-04 08:29:02 字数 1225 浏览 1 评论 0原文

当将自定义按钮添加到子网格(使用 jqgrid navButtonAdd)但仅在 FireFox 和 IE 中时,导航按钮(无论是在 toppager 还是常规寻呼机上)是否存在错误?它似乎在 Chrome 中工作/看起来很好 - 而且父网格的自定义按钮在 Firefox 和 IE 中也工作得很好,这只是一个装饰问题/悬停和大小问题,仅在网格中作为这些浏览器的子网格出现。

这是按钮大小和悬停位置的错误。

看看这张图片就明白我的意思了: https://i.sstatic.net/SL0KE.png

我的代码(在 subGridRowExpanded 属性中子网格)是这样的:

jQuery("#" + subgrid_table_id).jqGrid('navButtonAdd','#RedirectsTable_' + row_id + '_t_toppager_left',
{
    caption : "Add New Region Url... ", buttonicon : 'ui-icon-plus',
    id : "btnAddNewRegionUrl_" + subgrid_table_id,
    onClickButton : function()
    {
        addNewRegionUrlRow("#" + subgrid_table_id, row_id);
    }
}).jqGrid('navButtonAdd','#RedirectsTable_' + row_id + '_t_toppager_left',
        {
            caption : "Copy All ", buttonicon : 'ui-icon-copy',
            id : "btnCopyRegionUrls_" + subgrid_table_id,
            onClickButton : function()
            {
                copyRegionUrlRows(row_id);
            }
        }); // etc chaining them like this.  Also, I add buttons in this manner for the parent grid and to the bottom pager as well

任何解决此问题的帮助将不胜感激。

谢谢! :)

Is there a bug with nav buttons (whether on the toppager or the regular pager) when custom buttons are added to a subgrid (using the jqgrid navButtonAdd) but only in FireFox and IE? It seems to work/look fine in Chrome - also the parent grid's custom buttons work fine in Firefox and IE, it is just a cosmetic issue/hover and size issue which appears only in grid as subgrids for these browsers alone.

It is a bug with the button sizes and hover placement.

Check out this picture to see what I mean:
https://i.sstatic.net/SL0KE.png

My code (in the subGridRowExpanded property of the subgrid) is like this:

jQuery("#" + subgrid_table_id).jqGrid('navButtonAdd','#RedirectsTable_' + row_id + '_t_toppager_left',
{
    caption : "Add New Region Url... ", buttonicon : 'ui-icon-plus',
    id : "btnAddNewRegionUrl_" + subgrid_table_id,
    onClickButton : function()
    {
        addNewRegionUrlRow("#" + subgrid_table_id, row_id);
    }
}).jqGrid('navButtonAdd','#RedirectsTable_' + row_id + '_t_toppager_left',
        {
            caption : "Copy All ", buttonicon : 'ui-icon-copy',
            id : "btnCopyRegionUrls_" + subgrid_table_id,
            onClickButton : function()
            {
                copyRegionUrlRows(row_id);
            }
        }); // etc chaining them like this.  Also, I add buttons in this manner for the parent grid and to the bottom pager as well

Any help fixing this would be greatly appreciated.

Thanks! :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

甲如呢乙后呢 2024-12-11 08:29:02

我仍然认为这是一个错误,并且感谢任何人的帮助,为什么这种情况只发生在子网格中,并且只发生在 FireFox 和 IE 中,而不是 Chrome 中......?

然而,我想我会发布一个黑客,这不是解决这个问题的“正确方法”,但它确实在美观上起作用。

在父网格的 colModel 的 subGridRowExpanded 属性内,我将以下代码放入 gridComplete 事件属性中,以便它设置这些子网格导航按钮的宽度一次网格已完成并可以使用。至少可以说这是一个不优雅的黑客,但它确实有效。

显然,这是对宽度进行硬编码,这是令人讨厌的 - 如果按钮文本是来自数据库或其他内容的动态文本,则该宽度将不起作用,但对我来说这是可以的。

所以我检查了 Chrome 报告的“正确”宽度,然后添加了这段代码(显然用你的 navButtonAdd 按钮 id 代替我的):

 gridComplete : function()
    {
    //hack for FF & IE widths dont work in subgrid nav buttons- bug in jqgrid?
    $("#btnAddNewRegionUrl_" + subgrid_table_id).children(".ui-pg-div").width("133px");
    $("#btnCopyRegionUrls_" + subgrid_table_id).children(".ui-pg-div").width("63px");
    $("#btnPasteRegionUrls_" + subgrid_table_id).children(".ui-pg-div").width("63px");
    }

希望这有用 - 但如果你有任何意见或建议,请插话为什么会这样。 @奥列格?

谢谢 :)

I still think this is a bug and would appreciate anyone's help as to why this only happens in subgrids and only in FireFox and IE but not Chrome...?

However, I thought I would post a hack which is not the "right way" to fix this, but it does work cosmetically.

Inside the subGridRowExpanded property of the colModel of the parent grid, I've put the following code in the gridComplete event property so that it sets the width of those subgrid nav buttons once the grid is done and ready to use. This is an inelegant hack to say the least, but it works.

Obviously this is hard coding the widths which is nasty - and would not work if the button text was dynamic from a database or something, but for me this is ok.

So I checked what Chrome reported as the "correct" widths and then added this code (obviously substitute your navButtonAdd button ids in place of mine):

 gridComplete : function()
    {
    //hack for FF & IE widths dont work in subgrid nav buttons- bug in jqgrid?
    $("#btnAddNewRegionUrl_" + subgrid_table_id).children(".ui-pg-div").width("133px");
    $("#btnCopyRegionUrls_" + subgrid_table_id).children(".ui-pg-div").width("63px");
    $("#btnPasteRegionUrls_" + subgrid_table_id).children(".ui-pg-div").width("63px");
    }

hope this is useful - but please chime in if you have any comments or suggestions why this is so. @Oleg?

thanks :)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文