可调整表格列的大小
我正在开发一个网络应用程序,并正在寻找一种创建我自己的数据网格的方法。
我知道有很多很棒的脚本,具有所有的花哨功能,但我需要自己的特定功能、CSS 样式以及在其中使用我自己的 ui 控件的能力。
实际上,我唯一需要的是调整列大小的能力。我并不真正关心标记是否不维护行结构或者不是语义,因为所有数据都将由 ajax 请求填充。
我在想一个可能的解决方案是让每一列成为一个 div。
有教程可以帮助我吗?
I'm developing a web app and am looking for a way to create my own datagrids.
I know that there are lots of fantastic scripts out there with all the bells and whistles, but I need my own specific functionality, css styling, and the ability to use my own ui controls in it.
Really, the only thing I need is the ability to resize the columns. I don't really care if the markup doesn't maintain the row structure or isn't semantic, because all of the data will be populated by ajax requests.
I was thinking a possible solution would be to make each column a div.
Is there a tutorial out there that can help me?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议使用 jQuery UI Ressized 并进行一些增强。该插件实际上只专注于调整大小并支持完全自定义,因为您可以在任何情况下添加自己的回调函数。然而,默认情况下,该插件无法调整表头的大小,但我可以使其使用有效的 HTML 运行,并在调整大小时更新表的 COLGROUP 区域。
具体的想法是:
插件初始化:
我描述了完整的解决方案,包括 JavaScript、HTML 标记、跨浏览器 CSS 和 Live-Demo,网址为 http://ihofmann.wordpress.com/2012/07/31/ressized-table-columns-with-jquery-ui/
I recommend to use jQuery UI Resizable with some enhancements. The plugin really focuses only on resizing and enables full customization since you can add your own callback functions at any event. By default, however, the plugin cannot resize table headers, but I could make it running with valid HTML, updating the table's COLGROUP area on resize.
The concrete idea would be:
Plugin init:
I described the full solution including JavaScript, HTML markup, cross-browser CSS and Live-Demo at http://ihofmann.wordpress.com/2012/07/31/resizable-table-columns-with-jquery-ui/