jquery - 如果选项卡未激活,jqgrid 无法在 jquery-ui 选项卡下正确加载

标签 jquery jqgrid

我正在使用 jquery-ui 选项卡,并且有 3 个选项卡。在每个选项卡中,我都会有一个 jqgrid(具有卡住列功能),它将在选择该选项卡时加载。 Jqgrid联系服务器来获取colmodel和数据。

当 jqgrid 服务器通信 ajax 调用正在进行时,如果我尝试导航到其他选项卡,则网格在之前打开的选项卡中无法正确加载(特别是卡住列功能不起作用)。

我相信,每当我导航到其他选项卡时,选项卡的内容都会被隐藏,这就是导致问题的原因。

有什么办法可以解决这个问题吗? 即使我导航到其他选项卡,jqgrid 也应该正确加载..

我使用了 oleg 提供的以下链接来实现卡住列功能。 http://www.ok-soft-gmbh.com/jqGrid/FrozenColumnsAndFilterToggle.htm

最佳答案

我找到了问题的解决方案,可能对某人有帮助.. 解决方案是我仅在 jquery ui-tabs 主页( http://jqueryui.com/demos/tabs/ )上找到的

Any component that requires some dimensional computation for its initialization won't work in a hidden tab, because the tab panel itself is hidden via display: none so that any elements inside won't report their actual width and height (0 in most browsers).

There's an easy workaround. Use the off-left technique for hiding inactive tab panels. E.g. in your style sheet replace the rule for the class selector ".ui-tabs .ui-tabs-hide" with

.ui-tabs .ui-tabs-hide {
    position: absolute;
    left: -10000px;
}

关于jquery - 如果选项卡未激活,jqgrid 无法在 jquery-ui 选项卡下正确加载,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9306019/

相关文章:

javascript - 单击其 td 元素后如何获取 tr 的 id?

jquery - 在struts2中更改jquery网格主题(ui.jqgrid.css位置)

javascript - Highcharts 根据数据系列值自定义显示工具提示

mysql - jqgrid 分页与 postgresql

带有页脚文本格式的 Jqgrid 问题

javascript - 如何将数据放在总 "FooterRow"上?

php - 当复选框为真时突出显示行

javascript - 使用 Jquery 来检查 Jquery 按钮集中的复选框

javascript - 在 iframe 中更改 iframe 的 src

javascript - 摆脱滚动条