GWT DataGrid:"无法找到ImageResource方法值(" cellTableLoading")"当重写样式时

时间:2013-07-03 15:45:44

标签: 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 = 

使用Inteface的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

1 个答案:

答案 0 :(得分:0)

以下作品。真。

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接口(属于CellTable.Resources的一部分)。您是否在myDataGrid.css中留下了一些未在原始界面中定义的虚假CSS类?

也许你只是通过重命名css而从CellTable转移到DataGrid,但没有更改内部类名。