PDA

View Full Version : Bug removing a TreeItem



jraue
11 Jun 2008, 2:05 AM
A bug that shows for me is that when I remove a BaseObject from a Tree by executing store.remove(baseObjChild, baseObjParent), and the child was the parent's last child, the parent will still keep its little arrow to the left and remains expandable (arrow points downwards then, but obviously no children are shown).

IMHO, the bug lies in TreeItemUI.class:252, which reads:

public void removeItem(TreeItem child) {
containerEl.removeChild(child.getElement());
if (item.getItemCount() == 0) {
item.setExpanded(false);
}
}

IMHO, it should read:

public void removeItem(TreeItem child) {
containerEl.removeChild(child.getElement());
if (item.getItemCount() == 0) {
item.setExpanded(false);
item.setLeaf(false);
}
}

Cheers,

Joachim

jraue
11 Jun 2008, 2:10 AM
Just tested it by changing the leaf property from a debug breakpoint, works for me like a charm.