gwt - 将自定义样式附加到 GWT CellTable(在本例中为所有单元格)

标签 gwt gwt-2.2-celltable

我有一个想追加的案例

white-space: nowrap;

我的 CellTable 中每个单元格的样式。目前它适用于所有表格,但很高兴知道两者都必须将其应用于特定的 CellTable 和所有 CellTables。

最佳答案

CellTables 有自己的CssResource .要覆盖应用于 cellTable 中所有单元格的此样式,请创建一个新的 css 文件:

/* Incremental changes from CellTable.css */ 
.cellTableCell {
  white-space: nowrap;
}

然后创建自己的 CellTable.Resources 接口(interface):
public interface TableResources extends CellTable.Resources {

    /**
       * The styles applied to the table.
       */
    interface TableStyle extends CellTable.Style {
    }

    @Override
    @Source({ CellTable.Style.DEFAULT_CSS, "MyOwnCellTableStyleSheet.css" })
    TableStyle cellTableStyle();

}

最后,在创建 cellTable 时,使用 constructor允许您指定要使用的资源
CellTable<Object> myCellTable = new CellTable<Object>(15, GWT.create(TableResources.class));

有关工作示例,请查看 GWT SDK 中提供的费用示例。

关于gwt - 将自定义样式附加到 GWT CellTable(在本例中为所有单元格),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6386070/

相关文章:

gwt - 在生产中包含 devModeRedirectEnabled=true 的缺点?

java - GWT:从 Java 调用 javascript 函数

GWT CellList单击以切换选择(多选)

java - 如何抓取 "shift+anykey"的NativeEvent.getKeyCode

java - JSONException : Misplaced object

mysql - 用于持久保存 Google App Engine 上的 GWT 项目的外部 MySQL 数据库

java - GWT CELLTABLE pager 如何确定用户点击了哪个按钮?

java - GWT CellTable 选择并单击 CheckBoxCell

GWT CellTable 以编程方式选择 CheckBoxCell

java - GWT - CSS GUI 通知用户 - 浏览器问题