首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >CellList GWT CSS样式

CellList GWT CSS样式
EN

Stack Overflow用户
提问于 2011-07-10 01:04:18
回答 1查看 4.2K关注 0票数 2

我在我的入口点创建了一个CellList。现在我想设置它的样式。(将所选单元格的颜色从蓝色改为深黑色)

据我所知,我只需要覆盖cellList的样式,选择所选的样式并更改背景颜色(然后保存在module.css中)

这就是我带来的东西。

代码语言:javascript
复制
@sprite .cellListSelectedItem {
/*gwt-image: 'cellListSelectedBackground';*/
/*BEFORE : background-color: #628cd5;*/
background-color: #2D2D2D;
color: white;
height: auto;
overflow: visible;
}

然而,每次我选择一个单元格,它仍然显示旧的颜色(#628cd5)。我做错什么了吗?

哦,是的,我清理了项目并重新启动了服务器--还清除了浏览器缓存。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-07-11 05:06:15

您需要告诉GWT使用新样式--简单地将它们添加到模块CSS文件中是不够的:

代码语言:javascript
复制
table = new CellTable<FooType>(12,
    CellTableResources.INSTANCE, keyProvider);

CellTableResources.INSTANCE应该是扩展CellTable资源包的资源包实例。类似于:

代码语言:javascript
复制
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();
}

当然,同样的事情也适用于CellTableStyle:

代码语言:javascript
复制
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();

   // ....

}
票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6636192

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档