I created a CellList in my entry point. Now I want to style it.( Changing the color of selected cell from blue to dark black )
In my knowledge, I only need to override the style of cellList, choose the selected one and change the background color (and then save inside the module.css)
So this is what I came with.
@sprit开发者_如何学编程e .cellListSelectedItem {
/*gwt-image: 'cellListSelectedBackground';*/
/*BEFORE : background-color: #628cd5;*/
background-color: #2D2D2D;
color: white;
height: auto;
overflow: visible;
}
However everytime I select a cell, it still displaying old color (#628cd5). Anything I did wrong?
And oh yes, I cleaned the project and restarted the server-and also clear browser cache.
You need to tell GWT to use the new styles -- simply adding them to your module CSS file isn't going to be enough:
table = new CellTable<FooType>(12,
CellTableResources.INSTANCE, keyProvider);
CellTableResources.INSTANCE should be a Resource bundle instance that extends the CellTable Resource bundle. Something like:
import com.google.gwt.core.client.GWT;
import com.google.gwt.resources.client.ImageResource;
import com.google.gwt.resources.client.ImageResource.ImageOptions;
import com.google.gwt.resources.client.ImageResource.RepeatStyle;
import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.cellview.client.CellTable.Style;
public interface CellTableResources extends CellTable.Resources {
public static CellTableResources INSTANCE = GWT.create(CellTableResources.class);
@Source("footer_bg.png")
@ImageOptions(repeatStyle = RepeatStyle.Both, flipRtl = true)
ImageResource cellTableFooterBackground();
@Source("header.png")
@ImageOptions(repeatStyle = RepeatStyle.Horizontal, flipRtl = true)
ImageResource cellTableHeaderBackground();
@Source("table_head_bg_left.png")
@ImageOptions(repeatStyle = RepeatStyle.None, flipRtl = true)
ImageResource cellTableHeaderFirstColumnBackground();
@Source("table_head_bg_right.png")
@ImageOptions(repeatStyle = RepeatStyle.None, flipRtl = true)
ImageResource cellTableHeaderLastColumnBackground();
@Source(CellTableStyle.DEFAULT_CSS)
Style cellTableStyle();
}
And then of course the same sort of thing for CellTableStyle:
import com.google.gwt.user.cellview.client.CellTable;
public interface CellTableStyle extends CellTable.Style {
String DEFAULT_CSS = "path/to/your/new/CellTable.css";
String cellTableCell();
// ....
}
精彩评论