This content has been marked as final.
Show 5 replies
-
1. Re: question about dynamic tree node in richfaces with ajax
ilya_shaikovsky Nov 17, 2008 5:37 AM (in response to blueskull)why you just can't define the full tree. Using ajax switchType only expanded node children will be loaded out of the box..?
-
2. Re: question about dynamic tree node in richfaces with ajax
blueskull Nov 17, 2008 5:47 AM (in response to blueskull)"ilya_shaikovsky" wrote:
why you just can't define the full tree. Using ajax switchType only expanded node children will be loaded out of the box..?
There're about 5000 tree nodes.
Query costs too much time. -
3. Re: question about dynamic tree node in richfaces with ajax
nbelaevski Nov 17, 2008 6:53 AM (in response to blueskull)Hi,
Tree is initialized lazily by default. Only the nodes actually rendered are processed, so you can implement getChildren/getChild/isLeaf methods of TreeNode to implement lazy loading.
However what are the problems with changeExpandListener? Can you please provide code for it? -
4. Re: question about dynamic tree node in richfaces with ajax
blueskull Nov 17, 2008 7:04 AM (in response to blueskull)<rich:tree style="width:300px" value="#{ajaxTreeBean.treeNode}" var="item" nodeFace="#{item.type}" switchType="ajax" rendered="true" immediate="false"> <rich:treeNode type="latn" iconLeaf="/images/tree/singer.gif" icon="/images/tree/singer.gif" changeExpandListener="#{ajaxTreeBean.processExpand}"> <h:outputText value="#{item.latn_name}" /> </rich:treeNode> </rich:tree>
public void processExpand(NodeExpandedEvent event) { DatabaseAccess dba = new DatabaseAccess(StaticJNDI.LOCAL_DS_NAME); Integer count_a = new Integer(1); TreeNode tree = (TreeNode) event.getComponent(); Map latnMap = (Map) tree.getData(); Integer latn_id = ((Number) latnMap.get("LATN_ID")).intValue(); List area_list = dba .doQueryAll("select * from area a where a.latn_id = " + latn_id); Iterator iterator_a = area_list.iterator(); while (iterator_a.hasNext()) { TreeNodeImpl nodeImpl_a = new TreeNodeImpl(); Map areaMap = (Map) iterator_a.next(); nodeImpl_a.setData(areaMap); tree.addChild(count_a, nodeImpl_a); count_a++; } }
it doesn't work -
5. Re: question about dynamic tree node in richfaces with ajax
blueskull Nov 17, 2008 7:05 AM (in response to blueskull)"nbelaevski" wrote:
Hi,
Tree is initialized lazily by default. Only the nodes actually rendered are processed, so you can implement getChildren/getChild/isLeaf methods of TreeNode to implement lazy loading.
However what are the problems with changeExpandListener? Can you please provide code for it?
Thank you for help! I'll try.