jQuery 选项卡中的多个 slickGrid
我正在创建多个 slickGrid 并将它们放入 jQuery 选项卡中。 第一个 jQuery 选项卡上的第一个 slickGrid 工作正常,但是当我切换到下一个选项卡时 在调整标题大小并且列未与标题对齐之前,slickGrid 上的数据列不会显示。有什么办法可以解决这个问题吗? 这是我的代码摘录:
<ul class="tabs">
<li><a href="#tab_1">FADF Mono</a></li>
<li><a href="#tab_2">BADF Mono</a></li>
<li><a href="#tab_3">BADF Color</a></li>
</ul>
<div class="tab_container">
<div id="tab_1" class="tab_content">
<div id="slickGrid_1"></div>
</div>
<div id="tab_2" class="tab_content">
<div id="slickGrid_2"></div>
</div>
<div id="tab_3" class="tab_content">
<div id="slickGrid_3"></div>
</div>
</div>
I am creating multiple slickGrids and puts them in a jQuery tab.
The first slickGrid on the first jQuery tab works fine, but when I switch to the next tab
the data columns on the slickGrid does not show up until you resize the header and the columns are not aligned to the header. Is there any way I can fix this?
here's my code exerp:
<ul class="tabs">
<li><a href="#tab_1">FADF Mono</a></li>
<li><a href="#tab_2">BADF Mono</a></li>
<li><a href="#tab_3">BADF Color</a></li>
</ul>
<div class="tab_container">
<div id="tab_1" class="tab_content">
<div id="slickGrid_1"></div>
</div>
<div id="tab_2" class="tab_content">
<div id="slickGrid_2"></div>
</div>
<div id="tab_3" class="tab_content">
<div id="slickGrid_3"></div>
</div>
</div>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
好的。好吧,我会尝试分解正在发生的事情以及为什么它不起作用。基本上可能发生的情况是,您在初始化 slickgrid 实例之前设置选项卡。了解这一点很重要,因为您的第二个和第三个选项卡本质上被赋予隐藏状态,因此您的光滑网格不会初始化。
尝试更改顺序,看看是否有效。如果没有,那么我建议将 slickfgrid 初始值设定项放入 document.ready 中,将选项卡初始值设定项放入 document.load 中。这有点hacky,但产生了很好的结果。
希望这是有道理的。
Okay. Well, I will try and break down what is going on and why it's nor working. Basically what is likely happening is that you are setting your tabs before you initialise your slickgrid isntances. This is important to know, because your second and third tabs are essentially given a hidden state and therefor your slickgrids are not initialising.
Try changing the order and see if that works. If it doesn't then I recommend putting your slickfgrid initializers into document.ready and your tab initializer into document.load. It's a little hacky, but yields good results.
Hope this makes sense.
您应该将网格加载移动到 jQuery 选项卡的“show”事件中。我必须使用这些事件而不是 document.ready/load ,因为我没有显示选项卡的 CSS 来删除“选项卡闪烁”,即使这种情况发生在页面加载和选项卡初始化时。我有这样的东西:
You should move the grid loading into the "show" event of the jQuery tab. I had to use these events instead of document.ready/load because I have my tabs' CSS displayed none to remove the "tab flash" even that happens right as the page loads and the tabs are being initialized. Something like this is what I have:
看来您可能正在努力解决我遇到的同样问题。 Jquery 选项卡隐藏行为会遇到 IE 和 Chrome 上的 slickgrid 渲染问题。 FIrefox 渲染得很好。
这就是我要说的——
对 jquery UI CSS 进行以下修改 -
从
到
Seems like you possibly are struggling with the same issue i was running into. Jquery tabs hiding behavior runs into slickgrid rendering on IE and chrome. FIrefox renders it fine.
This is what I'm talking about -
Make the following modification to jquery UI CSS -
from
to
这基本上是我的 jquery 的代码重构,该代码是由 php 代码动态生成的。
this basically is a code reconstruction of my jquery, this code is dynamically generated by a php code.