Joe*_*oey 2 gwt datagrid cell custom-cell gwt-celltable
我已经渲染了一个自定义单元格,它结合了图像和文本.它看起来像这样:
class ImageTextCell extends AbstractCell<String>
Run Code Online (Sandbox Code Playgroud)
我的问题是如何将此单元格添加到celltable/datagrid中.我已经厌倦了.
Column<Message, String> iconColumn = new Column<Message, String>(new ImageTextCell())
{
@Override
public String getValue(Message versionStatus) {
return ? // I dont know what to type here. How to return the ImageTextCell object }
};
Run Code Online (Sandbox Code Playgroud)
Ril*_*ark 11
Cell对象的作用是将值转换为HTML.这个角色Column是从每一行获取该值.例如,你有一堆Messages,每一个都在它自己的行上 - 专栏应该拿a Message并找出String传递给它的内容Cell.
输出getValue将输入到输入render.输出render应该是您要在应用中看到的HTML.
伪身体,这是GWT为您做的:
for each Message in your table {
pass the Message into Column.getValue and get out a String
pass that String into Cell.render and get out some HTML
add that HTML inside a <td> element in the table we're drawing
}
Run Code Online (Sandbox Code Playgroud)
您只需要定义Column.getValue和Cell.render,以便此进程生成所需的表.
| 归档时间: |
|
| 查看次数: |
4121 次 |
| 最近记录: |