not calling nodeSelectListener method for 2nd time in rich:t
utpal.ptr Dec 22, 2008 3:55 AMHi,
After rendering the tree component the action method for nodeSelectListener attribute is being called for very 1st time. But 2nd time while I click the same node that method is not calling.
Can anybody help me. Here is the code:-
<a4j:outputPanel id="treeOutputPanel" ajaxRendered="true">
<rich:panel rendered="#{applicantViewState.treePanel}" id="PanelTree">
<h:panelGrid id="treeGrid" columns="1" style="font-size: 7px;">
<a4j:region id="regionTree">
<rich:tree id="treeComponent" style="width: 300px;font-size: 10px;"
value="#{premisesTreeRenderer.treeStructure}" var="data" reRender="premisespanelDetails,treeOutputPanel"
nodeSelectListener="#{premisesTreeRenderer.processSelection}" ajaxSubmitSelection="true" switchType="client">
<rich:treeNode ajaxSubmitSelection="true" limitToList="true" onclick="submit();">
<h:outputText value="#{data}" />
</rich:treeNode>
<a4j:support event="onselect" reRender="premisespanelDetails" immediate="true"/>
</rich:tree>
</a4j:region>
</h:panelGrid>
</rich:panel>
</a4j:outputPanel>
<a4j:outputPanel id="premisespanelDetails" ajaxRendered="true">
<--some code here--->
</a4j:outputPanel >
In my controller:-
public void processSelection(NodeSelectedEvent event) {
System.out.println(" ************ process Selection is STARTED *********** ");
// getting the object of ApplicationViewState Object
applicantViewState = (ApplicantViewState)FacesUtil.getBean("applicantViewState");
// getting the object of PremisesController
premisesController =(PremisesController)FacesUtil.getBean("premisesController");
System.out.println("5000---event.getComponent()="+event.getComponent());
UITree tree = (UITree) event.getComponent();
Object selectedTreeItem = tree.getRowData();
System.out.println("selectedTree Item is----------->" + selectedTreeItem);
// making BreadCrumb Enable
premisesController.setBreadCrumb(true);
// if user clicks on Add NewLocation Node
/*if(event.getComponent() instanceOf UITreeNode){
}*/
if(selectedTreeItem instanceof java.lang.String){
// Making TreeStrcutre is hiding
System.out.println("************* Selectd Tree Item is New String to add Location Now ******************");
applicantViewState.setTreePanel(false);
//Added By Utpal
//tree.setRendered(false);
//End of Utpal code
// Enbling Location Panel to True
applicantViewState.setLocationPanel(true);
// setting the Required Links in BreadCrumbs
premisesController.setPremisesLink(true);
premisesController.setLocationLink(true);
// for Adding new Location
Location location = new Location();
premisesController.setSelectedLocation(location);
premisesController.addLocation();
}
if(selectedTreeItem instanceof Location){
System.out.println("************* Selectd Tree Item is Location Now ******************");
applicantViewState.setTreePanel(false);
premisesController.setPremisesLink(true);
premisesController.setLocationLink(true);
applicantViewState.setLocationPanel(true);
selectedLocation =(Location)selectedTreeItem;
}
if(selectedTreeItem instanceof Building){
System.out.println("************* Selectd Tree Item is Building Now ******************");
applicantViewState.setTreePanel(false);
applicantViewState.setBuildingPanel(true);
selectedBuilding=(Building)selectedTreeItem;
}
/*
applicantViewState = (ApplicantViewState)FacesUtil.getBean("applicantViewState");
int i=0;
if(i==0){
applicantViewState.setTreePanel(true);
applicantViewState.setLocationPanel(true);
i++;
}
else if(i==1){
applicantViewState.setTreePanel(true);
applicantViewState.setBuildingPanel(true);
}
else
{
}*/
}