css - GWT 数据网格 : "Unable to find ImageResource method value("cellTableLoading")"when overriding styles

标签 css gwt datagrid

我试图像这里描述的那样覆盖 GWT DataGrid 组件的样式:

DataGrid / CellTable styling frustration -- overriding row styles

我的界面

public interface DataGridResources extends DataGrid.Resources {
@Source({ DataGrid.Style.DEFAULT_CSS, "myDataGrid.css" })
DataGrid.Style dataGrid();
}

public static final DataGridResources dataGridResources = 

使用接口(interface)的Datagrid实例

GWT.create(DataGridResources.class);

static {
    dataGridResources.dataGrid().ensureInjected();
}

...

dataGrid = new DataGrid<User>(10, dataGridResources);

但是我得到以下错误:

Rebinding xxx.DataGridResources
-Invoking generator com.google.gwt.resources.rebind.context.InlineClientBundleGenerator
--Creating assignment for dataGrid()
---Creating image sprite classes
----Unable to find ImageResource method value("cellTableLoading") in xxx.DataGridResources : Could not find no-arg method named cellTableLoading in type xxx.DataGridResources
--Generator 'com.google.gwt.resources.rebind.context.InlineClientBundleGenerator' threw an exception while rebinding 'xxx.DataGridResources'
-Deferred binding failed for 'xxx.DataGridResources'; expect subsequent failures

最佳答案

以下作品。真的。

public interface Resources extends DataGrid.Resources {

  interface Style extends DataGrid.Style { }

  @Source(value = {DataGrid.Style.DEFAULT_CSS, "myDataGrid.css"})
  public Style dataGridStyle();
}

此外,您不需要调用 ensureInjected(),因为 DataGrid 会为您调用它。

无论如何,错误日志中有问题:它寻找 cellTableLoading 样式,它不是 DataGrid.Resources 接口(interface)的一部分(是 CellTable 的一部分.资源)。您是否在 myDataGrid.css 中留下了一些原始接口(interface)中未定义的虚假 CSS 类?

也许您已经从 CellTable 移动到 DataGrid,只是重命名了 css,但没有更改内部类名称。

关于css - GWT 数据网格 : "Unable to find ImageResource method value("cellTableLoading")"when overriding styles,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17452454/

相关文章:

jquery - 使用 jquery 将类添加到 nth-child

html - 如何强制 div 到包装 div 的底部并设置背景颜色

java - GWT 将一个元素插入另一个元素(跨入 anchor )

c# - 使用 DataTable 的 DataGrid 中的 WPF 单个单元格颜色

c# - 设置winform DataGridView的显示格式

html - imageslider 在 html css 中下降

javascript - 将 HTML 转换为 PDF 时如何在每个页面的底部添加页脚

java - 什么 Web UI 框架最适合构建动态页面/表单?

Javax 验证约束 - 比较两个日期

c# - DataGridTextColumn 百分比宽度