Looks like we can't reproduce the issue or there's a problem in the test case provided.
-
Sencha User
LiveGridView - NullPointerException
Version(s) of Ext GWT
Ext GWT 3.0 Final
Browser versions and OS (and desktop environment, if applicable)
IE 9, Windows 7
Virtual Machine
No
Description
I'm using a LiveGridView without a Loader, and that leads to a NullPointerException:
Caused by: java.lang.NullPointerException: null
at com.sencha.gxt.widget.core.client.grid.LiveGridView.initData(LiveGridView.java:361)
at com.sencha.gxt.widget.core.client.grid.GridView.init(GridView.java:1854)
at com.sencha.gxt.widget.core.client.grid.Grid.onAttach(Grid.java:957)
You're not checking whether the loader is null and try to add a LoadHandler to that (non-existent) loader.
Run mode
Development Mode
Test case
Code:
public class MyGrid extends Grid
{
static TestProvider prov = GWT.create(TestProvider.class);
public MyGrid()
{
super(new ListStore<TestDTO>(prov.oid()), new ColumnModel(getColumnConfigList()),
new LiveGridView<TestDTO>());
setBorders(true);
getView().setColumnLines(true);
getStore().add(new TestDTO(1, 3, 1));
getStore().add(new TestDTO(2, 4, 2));
getStore().add(new TestDTO(3, 9, 6));
getStore().add(new TestDTO(4, 7, 2));
}
private static List<ColumnConfig> getColumnConfigList()
{
List<ColumnConfig> columnConfigList = new ArrayList<ColumnConfig>();
columnConfigList.add(new ColumnConfig(prov.att1(), 250, "Column 1"));
columnConfigList.add(new ColumnConfig(prov.att2(), 250, "Column 2"));
return columnConfigList;
}
class TestDTO
{
private int oid;
private int att1;
private int att2;
public TestDTO(int oid, int att1, int att2)
{
super();
this.oid = oid;
this.att1 = att1;
this.att2 = att2;
}
public int getAtt1()
{
return att1;
}
public void setAtt1(int att1)
{
this.att1 = att1;
}
public int getAtt2()
{
return att2;
}
public void setAtt2(int att2)
{
this.att2 = att2;
}
public int getOid()
{
return oid;
}
public void setOid(int oid)
{
this.oid = oid;
}
}
interface TestProvider extends PropertyAccess<TestDTO>
{
ModelKeyProvider<TestDTO> oid();
ValueProvider<TestDTO, Integer> att1();
ValueProvider<TestDTO, Integer> att2();
}
}
-
Currently LiveGridView always requires a Loader. You could simple use a MemoryProxy for now that serves local data too. I am closing this thread for now, but keeping it on the list as a feature request.