我浪费了大量时间来尝试使用Basic Grid。我使用这个版本的库:
<dependency>
<groupId>com.google.gwt</groupId>
<artifactId>gwt</artifactId>
<version>2.1.1</version>
</dependency>
<dependency>
<groupId>com.extjs</groupId>
<artifactId>gxt</artifactId>
<version>2.2.0</version>
</dependency>
我通过这个例子做了所有:http://zawoad.blogspot.com/2009/08/how-to-create-simple-grid-using-gxtext.html 在moduleOnLoad中,我写了这个:
@Override
public void onModuleLoad() {
User admin = new User();
admin.setLogin("Admin");
admin.set("login", "admin");
List<User> users = Arrays.asList(admin);
List<ColumnConfig> configs = new ArrayList<ColumnConfig>();
ColumnConfig loginColumn = new ColumnConfig("login", "Login", 100);
configs.add(loginColumn);
ListStore<User> listStore = new ListStore<User>();
listStore.add(users);
ColumnModel cm = new ColumnModel(configs);
Grid<User> grid = new Grid<User>(listStore, cm);
grid.setStyleAttribute("borderTop", "none");
grid.setAutoExpandColumn("login");
grid.setBorders(true);
grid.setStripeRows(true);
RootPanel.get().add(grid);
RootPanel.get().add(grid);
}
但是我得到了以下例外:
onModuleLoad() threw an exception
Exception while loading module com.XXXX.client.TaskGWTEntryPoint. See Development Mode for details.
java.lang.reflect.InvocationTargetException
......
Caused by: java.lang.RuntimeException: Deferred binding failed for 'com.extjs.gxt.ui.client.widget.grid.GridTemplates' (did you forget to inherit a required module?)
at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:53)
at com.google.gwt.core.shared.GWT.create(GWT.java:57)
at com.google.gwt.core.client.GWT.create(GWT.java:85)
at com.extjs.gxt.ui.client.widget.grid.GridView.initTemplates(GridView.java:1343)
at com.extjs.gxt.ui.client.widget.grid.GridView.init(GridView.java:1211)
at com.extjs.gxt.ui.client.widget.grid.Grid.onRender(Grid.java:863)
at com.extjs.gxt.ui.client.widget.Component.render(Component.java:1003)
at com.extjs.gxt.ui.client.widget.Component.onAttach(Component.java:1617)
at com.google.gwt.user.client.ui.Widget.setParent(Widget.java:475)
at com.google.gwt.user.client.ui.Panel.adopt(Panel.java:127)
at com.google.gwt.user.client.ui.ComplexPanel.add(ComplexPanel.java:97)
at com.google.gwt.user.client.ui.AbsolutePanel.add(AbsolutePanel.java:97)
at
com.XXXX.client.TaskGWTEntryPoint.onModuleLoad(TaskGWTEntryPoint.java:42)
... 9 more
Caused by: java.lang.IncompatibleClassChangeError: Found interface com.google.gwt.core.ext.typeinfo.JClassType, but class was expected
at com.extjs.gxt.ui.rebind.core.TemplatesGenerator$SourceGenerator.validateType(TemplatesGener ator.java:142)
需要什么模块?这存在于我的* .gwt.xml中:
<inherits name='com.extjs.gxt.ui.GXT'/>
为什么我的基本网格不起作用? 谢谢你的回答
答案 0 :(得分:0)
它看起来像Found interface com.google.gwt.core.ext.typeinfo.JClassType, but class was expected的副本,对此有很好的答案。
基本上你应该升级到最新版本......