View Full Version : [FIXED] [rev.1650] NullPointerEx. in CheckBoxSelectionModel.setChecked during onClear

20 Jul 2009, 1:35 AM
The following code gives a NullPointerException within CheckBoxSelectionModel while a ListStore is loading:

public void onModuleLoad() {
Grid<BaseModel> grid;
List<ColumnConfig> columns = new ArrayList<ColumnConfig>();
CheckBoxSelectionModel<BaseModel> checkBoxSM = new CheckBoxSelectionModel<BaseModel>();
ColumnModel columnModel = new ColumnModel(columns);
DataProxy<PagingLoadResult<BaseModel>> proxy = new DataProxy<PagingLoadResult<BaseModel>>() {
public void load(DataReader<PagingLoadResult<BaseModel>> reader, Object loadConfig, AsyncCallback<PagingLoadResult<BaseModel>> callback) {
List<BaseModel> list = new ArrayList<BaseModel>();
list.add(new BaseModel()); // dummy data
PagingLoadResult<BaseModel> plr = new BasePagingLoadResult<BaseModel>(list);
BasePagingLoader<PagingLoadResult<BaseModel>> ldr = new BasePagingLoader<PagingLoadResult<BaseModel>>(proxy);
ListStore<BaseModel> store = new ListStore<BaseModel>(ldr);
grid = new Grid<BaseModel>(store, columnModel);

Seems to be related to thread CheckBoxSelectionModel select method does not work (http://extjs.com/forum/showthread.php?t=74173) but in my case I don't see why there should be a RuntimeException.

The test case could easily be fixed by changing line order, but in my application I have no control on when the store loads.

GXT version: 2.0 current (rev. 1650)
Mode: Hosted mode
OS: Windows XP

20 Jul 2009, 6:47 AM
Fixed in SVN (was linked to the other change)

20 Jul 2009, 6:58 AM

14 Sep 2009, 7:17 AM
Fixed in SVN (was linked to the other change)

Has this been released? I have a lot of trouble with a Grid that has a CheckBoxSelectionModel.

Whenever I modify the Store (add, clear, etc), an event is propagated to the CheckBoxSelectionModel that results in calls to onClear/onAdd/etc. All of those methods call the "setChecked"-method that always throws a NullPointerException.

private void setChecked(boolean checked) {
if (grid.isViewReady()) {
El hd = grid.getView().innerHd.child("div.x-grid3-hd-checker");
hd.getParent().setStyleName("x-grid3-hd-checker-on", checked); // hd is null

After debugging the issue I found out that the variable "hd" is null whenever "setChecked is called. The store is empty on startup and I cannot modify the store because of the nullpointer. I need to be able to select grid rows to allow context-specific actions.

Is this related to the issue described here and has the fix already been released?