【问题标题】:CellList GWT CSS StyleCellList GWT CSS 样式
【发布时间】:2011-07-09 17:04:17
【问题描述】:

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

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

所以这就是我带来的。

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

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

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

【问题讨论】:

    标签: css gwt


    【解决方案1】:

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

    table = new CellTable<FooType>(12,
        CellTableResources.INSTANCE, keyProvider);
    

    CellTableResources.INSTANCE 应该是扩展 CellTable 资源包的资源包实例。比如:

    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 也是同样的事情:

    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();
    
       // ....
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多