Defining GWT CellTables with UiBinder

两盒软妹~` 提交于 2019-12-03 12:20:25

Evidently, in the second listing you're trying to add a column as a child object. Cell table doesn't accept children directly (meaning there is no addChild(...) method).

If you have fixed number of columns and want to use UIBinder consider using mere HTML table. In that case you will have all columns in the XML file, but the table will become harder to work with - HtmlElement not Widget.

<table ui:field="table">
    <col ui:field="firstColumn" class="{style.firstColumn}">
    <col ui:field="secondColumn"  class="{style.secondColumn}">
    ...
</table>

And the code might look like the following

... 
@UiField
private TableColElement firstColumn;

@UiField
private TableColElement secondColumn;

But all other operations with the table will be via DOM. Like table.appentChild(rowElement). I think doing like this doesn't worth it.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!