具有水平和垂直滚动以及固定标题和固定列宽的 html 表格
我有一个 HTML 表格,我想要
- 垂直滚动
- 水平滚动
- 固定标题(不垂直滚动,但水平滚动)
- 固定列宽度 - 即
- 理想情况下固定表格布局,固定第一列(如冻结窗格)
我的研究表示你不能在纯 CSS 中执行此操作,因为典型的策略是为标题创建一个 header div,然后为表格数据创建另一个 div,然后使用 jQuery/javascript 同步标题/表格数据的滚动。
我尝试了一些插件,实际上深入研究了这两个
http://www.novasoftware.com/Download/jQuery_FixedTable/JQuery_FixedTable.aspx
但是,这些插件对我不起作用,因为我需要/更喜欢固定列宽而不是自动列宽- 调整大小。
如果有人能解决我的问题或者可以推荐如何修改固定宽度的插件,我将不胜感激!
希望我没有要求太多!
I have an HTML table that I'd like to have
- vertical scrolling
- horizontal scrolling
- fixed headers (that do not vertical scroll, but do horizontal scroll)
- fixed column widths - i.e. fixed table layout
- ideally, fixed first column (like freeze panes)
My research indicates that you can't do this in pure CSS because the typical strategy is to create a header div for the headings and then another div for the table data, and then use jQuery/javascript to synchronize the scrolling of the header/table data.
I've tried a few plug-ins, and actually did a deep dive into these two
http://www.novasoftware.com/Download/jQuery_FixedTable/JQuery_FixedTable.aspx
However, these plug-ins don't work for me because I need/prefer to have fixed column widths as opposed to auto-resizing ones.
If anybody has a solution to my problem or can recommend how to modify the plug-ins for fixed width, it would be greatly appreciated!
Hopefully I'm not asking for too much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我觉得nova jquery的fixedtable还可以,它的特点是:
,为什么不问他们的开发人员。
http://www.novasoftware.com/contactus.aspx
I think the nova jquery fixedtable is just ok, its Features are:
anyway, why not ask their developers.
http://www.novasoftware.com/contactus.aspx
我遇到了同样的问题,并为您的问题提出了一个轻量级的解决方案。我所做的是:
我的问题的解决方案是在 buildFixedTable 中执行此操作:
替换
var th = $(1*).appendTo(target);
使用
var th = $(2*).appendTo(target);
并将
OnRowDataBound="GridView1_RowDataBound"
添加到网格定义中并为此创建了一个受保护的空处理程序,我在其中设置了列宽度。
瞧!
其中
lt
= Less_than_signgt
= Greater_than_sign可能需要对您的实现进行一些测试,但它解决了我的问题......
I was presented with the same problem and came up with a lightweight solution to your problem. What I did was:
The solution for my issue was to do this in buildFixedTable:
Replaced
var th = $(1*).appendTo(target);
With
var th = $(2*).appendTo(target);
And added
OnRowDataBound="GridView1_RowDataBound"
to the grid definitionAnd made a protected void handler for this where I set the column widths.
Voila!
Where
lt
= Less_than_signgt
= Greater_than_signMight require some testing for your implementation, but it solved my issue ...