PDA

View Full Version : GridView does not assume that ModelData could be null.



Mike Chaliy
30 May 2009, 8:08 AM
protected void detachWidgets(int startRow, int endRow, boolean remove) {
if (endRow == -1) {
endRow = ds.getCount() - 1;
}
for (int i = startRow; i <= endRow; i++) {
detachWidget(grid.getStore().getAt(i)/* Here possible null*/, remove);
}
}

protected void detachWidget(ModelData modelData, boolean remove) {
/* modelData could be null*/
Map<Integer, Widget> m = modelData.get("gxt-widgetlist");
if (m != null) {
for (Widget w : m.values()) {
ComponentHelper.doDetach(w);
}
if (remove) {
modelData.set("gxt-widgetlist", null);
}
}
}


I think better way is to prevent this in insert() method...