如何设置gwt 2.1 CellTables标题的样式?

rap*_*ura 11 gwt view uibinder gwt2

除了引用包含一些"CssResource"并使用ClientBundle获取它之外,我在文档中看不到任何内容,但是如何完全覆盖CellTable的tbody和th?

这可能吗?

Hil*_*amp 26

创建一个界面:

  interface TableResources extends CellTable.Resources {
    @Source({CellTable.Style.DEFAULT_CSS, "<your css file>.css"})
    TableStyle cellTableStyle();
  }

  interface TableStyle extends CellTable.Style {
  }
Run Code Online (Sandbox Code Playgroud)

并初始化单元格表:

    CellTable.Resources resources = GWT.create(TableResources.class);
    table = new CellTable<SomeProxy>(rowSize, resources);
Run Code Online (Sandbox Code Playgroud)

在cellview.client包中,您可以找到默认的gwt css文件.哟用这些作为起点.在"<your css file>.css"你的具体风格变化.

您还可以设置colum样式(在col元素上):

table.addColumnStyleName(colNumer, "some_css_style_name");
Run Code Online (Sandbox Code Playgroud)

或者更好地使用css资源名称而不是字符串"some_css_style_name".

  • 在CellTable中使用`@UiField(provided = true)`.这样UiBinder知道你在代码中创建表. (2认同)