0

Tree component onSelect performs load on demand (onOpen event)

asked 2015-07-28 18:20:46 +0800

michaelh gravatar image michaelh
27 1

I have created an interface using the Tree component. The tree lists the items from the database (3 data types). This tree component uses the load-on-demand features where the node class method, getChild() or getChildCount() performs the load from the database. Typically these methods are called during the onOpen event when the user clicks on the arrow to expand the node. This is working just fine. My problem is I also have an onSelect event that I listen to in the view model. On selection it is to change the view on the web page based on the node type selected. I am seeing that the onOpen event is also getting trigger during the onSelect event. I don't believe that this should be happening when selecting a treeitem. This causes performance issues when a user merely selects a tree item due to large amounts of data. How can I prevent the onOpen event from triggering during the onSelect event? I'm using ZK 7.0.5.FL.20150323.

delete flag offensive retag edit

Comments

I can't reproduce this issue, check the zkfiddle sample. If your use case is different from mine, please provide your sample.

vincentjian ( 2015-07-29 04:30:56 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-09-27 15:23:19 +0800

Ignis11 gravatar image Ignis11
11 1

I work on ZK 8.5.0. CE And I suffer the same issue.

I implemented AbstractTreeModel, and when I try to select a node on the tree, the model will try to load again.

link publish delete flag offensive edit

Comments

A common issue when extending AbstractTreeModel is to forget implementing a specialized getPath method. https://www.zkoss.org/wiki/ZKDeveloper'sReference/MVC/Model/TreeModel#OpenTree_Nodes

The default implementation performs a depth-first-inside the model - which can lead to a full reload.

cor3000 ( 2018-09-28 14:25:45 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
3 followers

RSS

Stats

Asked: 2015-07-28 18:20:46 +0800

Seen: 27 times

Last updated: Sep 27 '18

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More