YUI 数据表宽度
这似乎是一个基本问题,但我无法弄清楚如何在 YUI 数据表上将表宽度设置为 100%。
我尝试这样做,
#dtContainer {
width: 100%;
}
#dtContainer table {
width: 100%
}
但这些方法都不起作用。
为了澄清,当表为空并且显示空消息时,我尝试将数据表宽度设置为 100%。
生成的表格是一个HTML表格;所以,我认为这应该可行。
This may seem like a basic question, but I'm having trouble figuring out how to set the table width to 100% on a YUI datatable.
I tried doing
#dtContainer {
width: 100%;
}
#dtContainer table {
width: 100%
}
but none of these approaches work.
To clarify, I am trying to set the datatable width to 100% when the table is empty and the empty message is displayed.
The generated table is an HTML table; so, I thought this should work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
不要使用 .yui-dt table { width:100%;} ,它似乎没有正确设置列宽。使用 myDataTable.setAttributes({width:"100%"},true);表格渲染后
Dont use .yui-dt table { width:100%;} , It doesn't appear to set the column widths correctly. Use myDataTable.setAttributes({width:"100%"},true); after table render
事实证明解决方案非常简单:
It turns out the solution is really simple:
这是一个丑陋的解决方案。但它有效,
问题是应用预渲染样式是毫无意义的,JavaScript 正在构建表格,后渲染是我所能做的全部工作。
this is an ugly solution. but it works
the problem is applying the style pre render is pointless, the javascript is building the table, post render is all I could get to work.
看起来这个小样式标签很神奇:
looks like this little style tag works magic:
为了在不同分辨率的各种屏幕上保持宽高比,我必须手动将列宽设置为总和为 100% 的百分比。
PS:可能不是最好的方法,但它解决了我的问题!
奎克斯。
To maintain aspect ratio across various screens with different resolutions, I had to manually set the column width as percentages that summed up to 100%.
PS: Might not be the best way to do this, but it solved my problem!
Kwex.
这应该可以解决问题。为我工作 AUI 2.5.1
This should do the trick. Worked for me AUI 2.5.1