I am getting an error when attempting to filter a grid when setting data to a ListGridRecord array. Please see below:
Error message:
No DataSource or invalid DataSource specified, can't create data model
Code:
ListGrid listGrid = new ListGrid(); listGrid.setHeight(318); listGrid.setWidth(750); listGrid.setShowFilterEditor(true); listGrid.setFilterOnKeypress(true); ListGridField foo1= new ListGridField("foo1", "foo 1"); ListGridField foo2= new ListGridField("foo2", "foo 2"); listGrid.setFields(new ListGridField[] {foo1, foo2}); ListGridRecord[] gridData = new ListGridRecord[foos.size()]; for (int i = 0; i < foos.size(); i++) { gridData[i] = new ListGridRecord(); gridData[i].setAttribute("foo1", foos.get(i).getFoo1()); gridData[i].setAttribute("foo2", foos.get(i).getFoo2()); } listGrid.setData(gridData);
No DataSource or invalid DataSource specified, can't create data model
Comment