我有一个想追加的案例
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/