jqGrid 和 JQuery UI 选项卡显示仅在主选项卡 (div) 上展开的网格
我已将一些网格 (jqgrid) 添加到 jQuery UI Tabs 对象。默认情况下展开的选项卡子项上的所有网格都完美显示。但是默认情况下不展开的 Tab 子项上的网格会永久显示较小的 jqGrid(jqgrid 的 autowidth=true)。有什么想法吗?
谢谢!
请参阅http://www.revolucion7.com/wp-content /uploads/2009/10/jqgridp1.JPG
换句话说...
我在一个页面上有两个选项卡,每个选项卡上都有 jqgrids。
两个 jqgrid 都设置了 autowidth 属性,问题是当页面加载时,第一个网格调整为容器的大小,但是当我单击第二个选项卡时,第二个网格没有调整为容器的大小。
I have added some grids (jqgrid) to a jQuery UI Tabs object. All the grids on the Tabs child that is expanded by default, displays perfectly. But the grids on the Tab children that are NOT expanded by default, permanently shows the jqGrid small (jqgrid with autowidth=true). Any ideas?
Thanks!
See http://www.revolucion7.com/wp-content/uploads/2009/10/jqgridp1.JPG
On other words ...
I have two tabs on a page with jqgrids on each one.
Both jqgrids have autowidth property set, the problem is when page loads the first grid is adjusted to the size of the container but when i clicked the second tab the second grid is not adjusting to the size of the container.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
您如何初始化其他选项卡上的 jqGrids?您应该在使用
show
事件显示选项卡时初始化它们,例如:如果您采用这种方法,您还需要跟踪每个网格的初始化时间,因此您不必尝试如果用户单击另一个选项卡然后单击返回上一个选项卡,则第二次创建它。
How are you initializing the jqGrids on the other tabs? You should initialize them when the tab is shown using the
show
event, for example:If you are doing this approach you will also need to keep track of when each grid is initialized, so you do not try to create it a second time if the user clicks on another tab then clicks back to the previous one.
有时您不想在显示事件上初始化 jqgrid,因为所有数据都是相似的并且可以在一个请求中提取。这种情况下,可以将所有jqgrid的宽度设置为可见的宽度,
然后在初始化时将每个jqgrid的width参数设置为该值。
Sometimes you don't want to initialize your jqgrid on the show event as all your data is similar and can be pulled in one request. In this case, you can set the widths of all jqgrids to the width of the visible one
Then set the width parameter of each jqgrid to this value when initializing.
我认为这可能与 这个问题
我敢打赌,在这个问题提出三年后,这个问题将会得到纠正,但我发现事实并非如此:)。我想过更新上面贾斯汀的答案,但出于与以前版本的兼容性的目的,我最终决定保留它,如果我违反了任何论坛规则,请告诉我,我将更新上面的答案
由于 jQueryUI 显示事件现已弃用,应重命名来
激活
,也可以使用新 APIui.index
现在已替换为ui.newTab.index()
,用于activate
和ui.tab.index()
用于创建
。我还发现我必须将一个函数绑定到 create 事件才能将网格放在第一个选项卡中。
总结一下,这是上面 Justin 的代码 的更新版本,希望它有所帮助,它对我有用:
I think this a possible duplicate with this question
I would've bet that three years after this question was asked this issue would be corrected but I see it's not :). I thought of updating Justin's answer above, but I finally decided to leave it for purpouses of compatibility of previous versions, if I'm violating any forums rules please let me know and I'll update the answer above
Due to changes in jQueryUI show event is now deprecated and should be renamed to
activate
, and also with the new APIui.index
is now replaced withui.newTab.index()
foractivate
and toui.tab.index()
forcreate
.I also found that I had to bind a function to the
create
event in order to put the grid in the first tab.Summing it up, here's the updated version of Justin's code above, hope it helps, it worked for me:
实际上,您可以通过向选项卡显示事件添加调整大小来使其更简单:
Actually, you can make it simpler by adding a resize to the Tab Show Event: