Required Information

Version(s) of Ext GWT
«Ext GWT 3.0.0b»

Browser versions and OS
(and desktop environment, if applicable)
  • «Chrome 17, Windows 7»

Virtual Machine
«Yes»

Description
Using the TreeGridSelectionModel.select(item, true) does not seem to work for a TreeGrid. I have traced the code execution to find out that in class AbstractStoreSelection.doSingleSelect(M model) the following code gets executed:

Code:
   if (store instanceof ListStore) {
      ListStore<M> ls = (ListStore<M>) store;
      index = ls.indexOf(model);
    }
    if (store instanceof TreeStore) {
      TreeStore<M> ls = (TreeStore<M>) store;
      index = ls.indexOf(model);
    }
In the case of a TreeGrid the first if block always applies because of the code found in the TreeGrid's constructor. createListStore()

Code:
    this.cm = cm;
    setTreeColumn(treeColumn);
    this.treeStore = store;
    this.store = createListStore();

    setSelectionModel(new TreeGridSelectionModel<M>());
However, executing index = ls.indexOf(model) will always return -1 even if the model exists in the treeStore. This seems to be related to method indexOf(model) that only looks for model in visibleItems. visibleItems seems to always be empty in the case of TreeGrids.

Code:
  public int indexOf(M item) {
    return visibleItems.indexOf(item);
  }
As i am new to GXT, it is possible that I am missing something obvious on the way to select items in TreeGrids.

Thanks.

Run mode
Development Mode

Possible fix

Maybe having visibleItems of ListStore populated upon TreeGrid creation.

Thanks