问题描述
如何以编程方式查找GWT CellTable标题的TH样式名称?
How can TH style name/s of a GWT CellTable's heading be looked up programatically?
我看过Client Bundle文档,但是对我来说如何将它们组合在一起并不太明显.谢谢.
I have looked at the Client Bundle documentation but it isn't immediately obvious to me how it all fits together. Thanks.
推荐答案
在访问TH样式名称时,不确定要执行的操作.
Not sure exactly what you want to do when accessing the TH style names.
如果要覆盖单元格表头的标准css样式,则可以覆盖以下一些css样式以更改组件的外观.
If you want to override the standard css style of a celltable header, here are some of the css styles you can override to change the Look and Feel of the component.
.cellTableFirstColumnHeader {}
.cellTableLastColumnHeader {}
.cellTableHeader {
border-bottom: 2px solid #6f7277;
padding: 3px 15px;
text-align: left;
color: #4b4a4a;
text-shadow: #ddf 1px 1px 0;
overflow: hidden;
}
.cellTableSortableHeader {
cursor: pointer;
cursor: hand;
}
.cellTableSortableHeader:hover {
color: #6c6b6b;
}
.cellTableSortedHeaderAscending {
}
.cellTableSortedHeaderDescending {
}
这是cellTables样式的完整列表, CellTable.css
Here is the complete list of styles for cellTables CellTable.css
现在,如果您想以编程方式访问标头,则可以使用以获取对应于表标题的TableSectionElement.然后,您可以访问该行,然后访问单元格,并查找它们的样式.
Now if you want to access you header programmatically, you can use this solution to get the TableSectionElement corresponding the the Header of your table. Then you can access the row, then the cells, and lookup for their styles I guess.
最后,如果您想覆盖标题样式,则可以在将列添加到表中时使用以下方法
Last thing if you want to override the header style, maybe you can use the following method when adding your column to your table
public void addColumn(Column<T, ?> col, Header<?> header)
然后创建您的Header或使用TextHeader例如,然后在其上设置样式,然后使用将其添加到表中
Then create your Header or use a TextHeader for example then set your style on it before adding it to the table using
public void setHeaderStyleNames(String styleNames)
示例
TextHeader textHeader = new TextHeader("headerTitle");
textHeader.setHeaderStyleNames("my-style");
myTable.addColumn(myColumn, textHeader);
这篇关于查找GWT CellTable标头样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!