-
1. Re: rich tree not working after
ilya_shaikovsky Nov 17, 2010 10:29 AM (in response to arul002)please show sources and check for JS errors.
-
2. Re: rich tree not working after
arul002 Nov 17, 2010 11:17 AM (in response to ilya_shaikovsky)
All the source files are available in the richfaces livedemo http://ludvigsens.net/richfaces-3.3.2/richfaces/tree.jsf?tab=model&cid=107033.Ilya Shaikovsky wrote:
please show sources and check for JS errors.
Still here it is,
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich">
<style>
.col, .col2 {
width:50%;
vertical-align:top;
}
</style>
<h:form>
<h:panelGrid columns="2" width="100%" columnClasses="col1,col2">
<rich:tree style="width:300px" nodeSelectListener="#{simpleTreeBean.processSelection}"
reRender="selectedNode" ajaxSubmitSelection="true" switchType="ajax"
value="#{simpleTreeBean.treeNode}" var="item" ajaxKeys="#{null}">
</rich:tree><h:outputText escape="false" value="Selected Node: #{simpleTreeBean.nodeTitle}" id="selectedNode" />
</h:panelGrid>
</h:form>
</ui:composition>Managed bean - simpleTreeBean is also available in the same livedemo page.
-
3. Re: rich tree not working after
ilya_shaikovsky Nov 19, 2010 7:41 AM (in response to arul002)I tried that on my local demo and works fine. Please consider checking on latest version.
-
4. Re: rich tree not working after
arul002 Nov 22, 2010 12:17 AM (in response to ilya_shaikovsky)Hi,
The issue is with tree.getRowData() in processSelection method. It gives IllegalStateException whenever I expand/collapse a node after selecting one of its child node. There must be a better solution but if I just catch this exception-do nothing, then everything's working fine.
public void processSelection(NodeSelectedEvent event) {HtmlTree tree = (HtmlTree) event.getComponent();Object rowKey = tree.getRowKey();// try {nodeTitle = (String) tree.getRowData(rowKey);selectedNodeChildren.clear();TreeNode currentNode = tree.getModelTreeNode(tree.getRowKey());/*} catch (IllegalStateException e) {e.printStackTrace();}*/public void processSelection(NodeSelectedEvent event) {
HtmlTree tree = (HtmlTree) event.getComponent();
Object rowKey = tree.getRowKey();
try {
nodeTitle = (String) tree.getRowData(rowKey);
selectedNodeChildren.clear();
TreeNode currentNode = tree.getModelTreeNode(tree.getRowKey());
} catch (IllegalStateException e) {
e.printStackTrace();
}
}
Ilya Shaikovsky wrote:
I tried that on my local demo and works fine. Please consider checking on latest version.
Could you please tell me the version of richfaces you tried. I tried it in 3.3.3.Final but still the problem exists - java.lang.IllegalStateException - No tree element available or row key not set!
-
5. Re: rich tree not working after
ilya_shaikovsky Nov 22, 2010 5:02 AM (in response to arul002)Yup, I could see the exception now also. But it not prevents the tree from working in my case, so I not found from the beginning. And it seems - catching the exception is the only way. It's looks like an issue in component but as we have no plans for 3.3.x branch releases - please use workaround.