gpt4 book ai didi

css - CellList GWT CSS 样式

转载 作者:行者123 更新时间:2023-11-28 10:56:59 24 4
gpt4 key购买 nike

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

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

这就是我带来的。

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

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

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

最佳答案

您需要告诉 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();

// ....

}

关于css - CellList GWT CSS 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6636192/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com