如何使 YUI DataTable 宽度为 100%
我用于创建数据表的代码如下所示:
myDataTable = new YAHOO.widget.ScrollingDataTable(
"containerDiv",
myColumnDefs,
myDataSource,
{height:"100px",width:"100%"}
);
该代码生成一个如下所示的表: (外部网站不再提供屏幕截图) http://drop.io/download/public/gfipf7axm6ydjsvua国际航空联合会/ 296829ffb3ad115ecf1d9e13a607eaf2e2dc2788/Asset/37984293/v3/large_thumbnail
请注意它如何创建一个 100% 拉伸的外框,就像我想要的那样,但表格本身并没有一直 100% 拉伸,相反,它仅足够大符合表格内容。
请注意,拉伸 100% 的外框是在运行上述代码时由 YUI 创建的,不是我自己创建的。
我真正需要的只是垂直滚动,没有水平滚动。但 YUI 不允许您指定其中之一,您可以同时获得两者。
有没有办法让桌子拉伸100%?我在 YUI 文档中没有找到任何关于这个问题的内容,除非我忽略了它。
感谢您的阅读!
My code for creating the data table looks like this:
myDataTable = new YAHOO.widget.ScrollingDataTable(
"containerDiv",
myColumnDefs,
myDataSource,
{height:"100px",width:"100%"}
);
That code produces a table that looks something like this:
(Screen shot not available anymore from external site)
http://drop.io/download/public/gfipf7axm6ydjsvuaiaf/296829ffb3ad115ecf1d9e13a607eaf2e2dc2788/Asset/37984293/v3/large_thumbnail
Notice how it creates an outer box stretching 100% just like I want it to, but the table itself does not stretch all the way 100%, instead it is only large enough to fit the contents of the table.
Please note that the outer box that stretches 100% is created by YUI when you run the above code, I didn't create that myself.
What I really need is just vertical scrolling and no horizontal scrolling. But YUI does not let you specify one or the other, you get both.
Is there a way to make the table stretch 100%? I didn't find anything about this issue in the YUI documentation, unless I have overlooked it.
Thanks for reading!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您使用
ScrollingDataTable
并指定宽度时,列不会自动调整大小。当您考虑一下时,这是有道理的 - 表必须处理视图中容纳太多列的情况,因此它不会尝试容纳它们。由于看起来您不需要水平滚动,因此删除宽度配置属性。要使表格达到您想要的宽度,您可以尝试:
When you use a
ScrollingDataTable
and specify a width, the columns are not auto-sized. This makes sense when you think about it - the table must handle cases where there are too many columns to fit in the view, so it doesn't attempt to fit them.Since it looks like you don't need horizontal scrolling, remove the width config attribute. To get the table to your desired width, you can try: