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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -