how to rerender a specific tree node in RichFaces 4
bcn Sep 28, 2011 7:45 AMI try to rerender a specific node by including it in a list which is passed to the render attribute of rich:tree in the tree node selection listener.
render="#{bean.filterTreeRenderComponentIDs}"
There is an old thread http://community.jboss.org/message/53393 about this. But if I try
filterTreeRenderComponentIDs.add(tree.getRowKey());
with a list of Object, I get
java.lang.ClassCastException: org.richfaces.model.SequenceRowKey cannot be cast to java.lang.String
at org.richfaces.renderkit.util.CoreRendererUtils.findComponentsFor(CoreRendererUtils.java:130) [richfaces-core-impl-4.0.0-20110325.220425-378.jar:]
at org.richfaces.context.RenderComponentCallback.doVisit(RenderComponentCallback.java:92) [richfaces-core-impl-4.0.0-20110325.220425-378.jar:]
at org.richfaces.context.ComponentCallback.visit(ComponentCallback.java:98) [richfaces-core-impl-4.0.0-20110325.220425-378.jar:]
at org.richfaces.context.BaseExtendedVisitContext.invokeVisitCallback(BaseExtendedVisitContext.java:337) [richfaces-core-impl-4.0.0-20110325.220425-378.jar:]
at org.richfaces.component.UIDataAdaptor.visitTree(UIDataAdaptor.java:1235) [richfaces-components-ui-4.0.0-20110322.220419-243.jar:]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1600) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:2.1.2-FCS]
If I try
String id = currentSelectionKey.getSimpleKeys()[0].toString();
filterTreeRenderComponentIDs.add("filterTree:" + id + ":tnCity");
(I checked that the complete id is really in the page)
I get
null: java.lang.NullPointerException
at org.richfaces.renderkit.TreeNodeRendererBase.addClientEventHandlers(TreeNodeRendererBase.java:172) [richfaces-components-ui-4.0.0-20110322.220419-243.jar:]
at org.richfaces.renderkit.html.TreeNodeRenderer.encodeBegin(TreeNodeRenderer.java:94) [richfaces-components-ui-4.0.0-20110322.220419-243.jar:]
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:820) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:2.1.2-FCS]
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1754) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:2.1.2-FCS]
at org.richfaces.context.ExtendedPartialViewContextImpl$RenderVisitCallback.visit(ExtendedPartialViewContextImpl.java:514) [richfaces-core-impl-4.0.0-20110325.220425-378.jar:]
at org.richfaces.context.BaseExtendedVisitContext.invokeVisitCallback(BaseExtendedVisitContext.java:337) [richfaces-core-impl-4.0.0-20110325.220425-378.jar:]
at javax.faces.component.UIComponent.visitTree(UIComponent.java:1589) [jboss-jsf-api_2.0_spec-1.0.0.Final.jar:2.1.2-FCS]
at org.richfaces.component.AbstractTreeNode.visitTree(AbstractTreeNode.java:197) [richfaces-components-ui-4.0.0-20110322.220419-243.jar:]
RF 4.0.0
Thanks