answered
2015-07-09 10:53:41 +0800
chillworld 5367 ● 4 ● 9
https://github.com/chillw...
Hey Roma,
The only solution like you suggest it, is opening the whole tree and close it afterwards.
But I like to point out, this will not be good.
Your performance will decrease a lot, because it's a huge tree.
I think your problem is how you do the search.
Most treemodels implement the TreeOpenableModel, so why don't you search in the viewmodel and eventually open just those nodes?
ZK will render them at that point, without rendering all your items.
If your script highlights the text, you can always run after the command the script.
Hope you can figure it out now.
Edit:
While I did try to make you clear to try separate the javascript and the rendering.
So try this :
@Command("openSearchTextNode")
public void openSearchTextNode(@ContextParam(ContextType.BINDER) Binder binder) {
if (StringUtils.isNotEmpty(searchText)) {
//root node
TreeNode<OctaveTreeRow> contratNode = contratTreeModel.getRoot().getChildAt(0);
//open node if the node contains the value
searchTextInChild(contratNode, searchText);
//like BindUtils.postNotifyChange(null, null, this, "contratTreeModel");
notifyChange("contratTreeModel");
binder.postCommand("callJavaScript", null);
}
}
@Command
public void callJavaScript() {
// js call
Clients.evalJavaScript("updateSearchDisplay(true);");
}
Greetz chill.