java - How do I get and select a treeItem that is not visible by index in JavaFX? -
i'm saving index of current select treeitem using treeview.getselectionmodel().getselectedindex();
. goal able reselect treeview item once treeview rebuild. there doesn't seem method in api allow me , select treeview item isn't under expanded node.
i've tried treeview.getselectionmodel().select(index);
seem work when treeitem's parent expanded. api doesn't mention item selected must under node expanded. tried treeview.gettreeitem(index).getparent().setexpanded(true);
expand item's parent node seem work if item visible , under expanded node.
so question is, how store current selected treeitem , re-select when treeview rebuilded.
try sir,
int i; = treeview.getselectionmodel().getselectedindex(); treeview.gettreeitem(i).setexpanded(true); treeview.getselectionmodel().select(i);
Comments
Post a Comment