如何使用CellTable进行单行扩展?
我正在尝试使用新的 GWT CellTable 小部件,但我的表格需要支持单行扩展,即行的左侧有一个 zippy,单击它时,该行应该扩展以提供更多详细信息,并且该行应该跨越所有列。是否可以使用 CellTable 来实现此目的?如何动态添加跨越其他行之间所有列的行?
任何帮助将不胜感激!
I'm trying to use the new GWT CellTable widget but my table needs to support one row expansion, i.e. there is a zippy on the left of a row and when it's clicked, the row should expand to provide more detail information and this row should span across all columns. Is it possible to achieve this with the CellTable? How do I add a row that spans all columns between other rows dynamically?
Any help will be appreciated!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
GWT 2.5 将添加一个
CellTableBuilder
,其确切目标是允许此类事情。您可以在 http://showcase2.jlabanca-testing.appspot.com/ 找到一个实例#!CwCustomDataGrid(点击“显示朋友”单元格)
GWT 2.5 will add a
CellTableBuilder
with the exact goal of allowing this kind of things.You can find a live example at http://showcase2.jlabanca-testing.appspot.com/#!CwCustomDataGrid (click on the "show friends" cells)
您能否使用
getRowElement(int row)
使附加行不可见,并使用 DOM 方法在渲染时将显示设置为“无”,并在单击显示它的按钮时将其设置为空白。Can you not make the additional row invisible using
getRowElement(int row)
and using DOM methods to set display 'none' when rendered and as blank when the button, to show it, is hit.我也在研究解决方案,我现在的计划是使用 CSS 类 + 手动样式操作来使其看起来像我需要的那样。不确定我是否能够与 GWT 一起快乐: http://jsfiddle.net/7WFcF/
I am working on the solution too and my plan for now is to use CSS classes + manual styles manipulation to make it look as I need. Not sure if I be able to merry it with GWT though: http://jsfiddle.net/7WFcF/
我采取了不同的方法来解决同样的问题。
基本概念是使用 dom 元素根据事件添加和删除行。下面的代码是CellTable的抽象扩展。您需要从单击展开行时触发的事件中调用此方法。
previousSelectedRow
用于跟踪哪个项目被“扩展”,这可能可以使用类或 ID 来实现。如果需要,我可以详细说明 CellTable、事件、视图和活动。
I took a different approach to solve this same problem.
The basic concept is using dom elements to add and remove rows based on an event. The following code is an abstract extension of CellTable. You'll want to call this method from your event that gets fired from the click to expand a row.
}
previousSelectedRow is used to track which item is "expanded", this could probably be achieved using classes or IDs. If needed I can elaborate more on the CellTable, events, views, and activities.