0 Replies Latest reply on Jun 17, 2009 12:10 PM by rajesha Indurthi

    a4j link not rendering as exected

    rajesha Indurthi Newbie

      Hi,
      In my JSF RI 1.1 application, Iam using richfaces 3.0 version. I have the following scenario which is not executing properly.

      I have a datatable, and one of the columns in the datatable is a a4j:commandLink, on clicking this link Iam reRendering a rich:panel which is part of the data table. The rich:panle is rendered based on a boolean flag in my beacking bean. The first time I log in to the page , the boolean criteria is true when I click the commandLink, the rich:panel is reRendered corectly. However Iam paging through the results in my datatable usinsg the commadLinks on the header of my table, when I click these links Iam delberately setting the boolean criteria to display the rich:panel to false, it works fine . Now once the boolean criteria is set to false, when I aagin click on my commanLink, even though I reset my boolean criteria to true and reRender the rich:panel it is not displaying the rich:panel.

      Please find below in my jsp code, I have displayed in bold the a4j:commandLink and the corresponding rich:panel which it is trying to reRender.

      I hope I was able to convey my probelm properly.

      In short:
      The a4j:commandLink reRenderes the rich:panel properly the first time I log in, but after that when I click any other links on my page (which reRenders something else on my page and sets the boolean flag to render rich:panel to false), however when I click the a4j:commanLink ,and in my backing bean am setting the boolean criteria to true, and reRender the rich:panel it is not reRendering, or I guess the boolean criteria is is stilll set to false for some reason.

      Please let me know what is that Iam missing, thanks in advance for your help!!!





      <html>
      <head>
      <%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
      <%@ taglib uri="http://richfaces.ajax4jsf.org/rich" prefix="rich"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
      <link rel="stylesheet" type="text/css"
       href="<c:url value='/css/hdr_body.css' />" />
      <link rel="stylesheet" type="text/css"
       href="<c:url value='/css/search-results.css' />" />
      <link rel="stylesheet" type="text/css"
       href="<c:url value='/css/menu.css' />" />
      <link rel="stylesheet" type="text/css"
       href="<c:url value='/css/form-controls.css' />" />
      <link rel="stylesheet" type="text/css"
       href="<c:url value='/css/cheat-sheet.css' />" />
      <script language="JavaScript" src="<c:url value='/js/TDFScript.js' />"></script>
      
      <style>
       .panel {
       vertical-align:top;
       }
      </style>
      
      </head>
      <body>
      
      <div id="wrap">
       <f:view>
       <f:subview id="menu">
       <jsp:include page="incld/toolbar.jsp" />
       </f:subview>
      
       <h:messages id="messages" layout="table" infoClass="okStatusText" errorClass="errorMsgText" />
      
      
      
       <div class="oneLineSearchFieldSet">
       <fieldset>
       <legend class="oneLineSearchLegend">Test Data Search Results</legend>
       <h:form>
       <h:selectOneMenu id="selectDataSource" value="#{oneLineSearchBean.selectedDataSource}" disabled="true">
       <f:selectItems value="#{oneLineSearchBean.availableDataSources}" />
       </h:selectOneMenu>
      
       <h:inputText id="searchText" value="#{oneLineSearchBean.searchText}" styleClass="textEntry" tabindex="1" size="60" maxlength="800" disabled="true"/>
      
       <h:commandButton id="modifyButton" value="Modify" action="#{searchResultsBean.modifyQuery}" styleClass="regularButton" rendered="#{not viewset}" onmouseover="window.status='Search Test Data Repository';return true" onmouseout="window.status='';return true" />
       <h:commandLink id="saveQueryLink" value="Save Query" action="#{tagQueryBean.createQueryTag}" styleClass="smallLink" rendered="#{not viewset}">
       </h:commandLink>
       <h:commandLink id="cancel" value="Cancel" action="#{searchResultsBean.cancel}" styleClass="smallLink" rendered="#{not viewset}">
       </h:commandLink>
       </h:form>
      
       <p>
       <h:panelGroup id="resultDisplayMessage" rendered="#{not empty SEARCH_RESULTS_SIZE}" >
       <h:outputText id="display" value="Displaying"/> <h:outputText id="firstRecordNum" value="#{searchResultsBean.data.first + 1}" style="font-weight:bold;padding:2px"/> <h:outputText id="to" value="to"/> <h:outputText
       id="lastRecordNum" rendered="#{SEARCH_RESULTS_FIRST_VISIT && not empty SEARCH_RESULTS_SIZE}"
       value="20" style="font-weight:bold;padding:2px" /> <h:outputText id="lastRecordNumber" rendered="#{not SEARCH_RESULTS_FIRST_VISIT}" value="#{searchResultsBean.data.first + searchResultsBean.data.rows}" style="font-weight:bold;padding:2px"/> <h:outputText id="searchResults" value="of your search results"/>
       </h:panelGroup>
       </p>
       </fieldset>
      
       </div>
      
      
      
       <%-- Begin results table/form --%>
      
      <a4j:form id="searchResultsForm">
      
      <rich:panel id="searchResultsPanel" style="width:100%;border:0px;text-align:right" headerClass="searchResultsPanelHeader">
       <f:facet name="header">
       <h:panelGroup id="headerPanel">
      
       <h:panelGroup style="padding-right:300px" id="commandPanel">
      
       <h:commandButton id="selectAllButton" value="Select All" styleClass="buttons special"
       style="margin:2pt;display: none; visibility: hidden;" action="#{searchResultsBean.selectAll}"/>
      
       <h:commandButton value="Deselect All" styleClass="buttons special"
       style="margin:2pt;display: none; visibility: hidden;" id="deSelectAllButton" action="#{searchResultsBean.deselectAll}"/>
      
       <h:selectBooleanCheckbox id="selectBox" value="#{searchResultsBean.selectAllCheckBox}" onclick="selectAllCheckBoxes();" style="margin-right:40px" >
       </h:selectBooleanCheckbox>
       <h:selectOneMenu value="#{searchResultsBean.selectedAction}" style="margin-right:10px" id="actionSelect">
       <f:selectItems value="#{searchResultsBean.availableActions}" />
       </h:selectOneMenu>
       <a4j:commandButton value="Go" id="goButton" action="#{scenarioRecordBean.executeAction}" styleClass="specialPanelHeader" reRender="messages"/>
       </h:panelGroup>
      
       <h:panelGroup style="padding-left:300px" id="linkPanelGroup">
       <a4j:commandLink value="first" action="#{searchResultsBean.pageFirst}"
       id="first" rendered="#{!searchResultsBean.navFirst}" styleClass="nav" style="margin-right:5px" reRender="searchResultsPanel,resultDisplayMessage" immediate="true">
       </a4j:commandLink>
      
       <a4j:commandLink value="<<" action="#{searchResultsBean.pagePrevious}" rendered="#{!searchResultsBean.navPrevious}"
       id="navPrev" styleClass="nav" style="margin-left:5px;margin-right:5px;" reRender="searchResultsPanel,resultDisplayMessage" immediate="true" >
       </a4j:commandLink>
      
       <a4j:commandLink value=">>" action="#{searchResultsBean.pageNext}"
       id="navNext" rendered="#{! searchResultsBean.navNext}" styleClass="nav" style="margin-left:5px;margin-right:5px;" reRender="searchResultsPanel,resultDisplayMessage" immediate="true">
       </a4j:commandLink>
      
       <a4j:commandLink value="last" action="#{searchResultsBean.pageLast}"
       id="last" rendered="#{! searchResultsBean.navLast}" styleClass="nav" style="margin-right:5px;" reRender="searchResultsPanel,resultDisplayMessage" immediate="true">
       </a4j:commandLink>
       <a4j:status id="stateStatus" startText="Processing..."
       startStyle="background-color:#ffA500"/>
      
       </h:panelGroup>
      
       </h:panelGroup>
       </f:facet>
       <rich:dataTable style="border:0px"value="#{SEARCH_RESULTS}" var="hit" id="searchresults" rendered="#{SEARCH_RESULTS != null && not empty SEARCH_RESULTS_SIZE}"
       headerClass="center" width="100%" binding="#{searchResultsBean.data}" rows="20" cellpadding="0" cellspacing="0">
      
       <h:column>
       <h:panelGrid columns="3" border="0" id="searchResultsTable" width="100%" columnClasses="panel" style="border-bottom-style:solid;border-bottom-color:black;border-bottom-width:thin">
      
       <rich:panel style="border:0px;margin:0px">
       <h:selectBooleanCheckbox value="#{hit.selected}" id="selectBox" style="align:center" />
       </rich:panel>
      
       <rich:panel style="border:0px;margin:0px" id="identPanel">
       <h:outputText style="font-weight:bold" value="This is a No-Hit File" rendered="#{hit.noHit}" id="hitNohit" />
      
       <h:panelGrid columns="1" id="identGrid">
       <a4j:commandLink action="#{searchResultsBean.displayDetails}" id="displayDetailsLink">
       <h:outputText value="#{hit.lastName}," style="margin-right:1px;font-size:xx-small" id="lastName" />
       <h:outputText value="#{hit.firstName}" style="font-size:xx-small" id="firstName" />
       </a4j:commandLink>
       </h:panelGrid>
       </rich:panel>
      
      
       <rich:panel style="border:0px;margin:0px;align:right">
       <a4j:commandLink action="#{searchResultsBean.displayDetails}" style="margin-right:2px;" id="displayDetailsIcon">
       <h:graphicImage id="displayDetailsImage" alt="More Details" url="/images/more-details.JPG" style="border:0"/>
       </a4j:commandLink>
      
       <a4j:commandLink action="#{scenarioRecordBean.saveSingleStepScenario}" reRender="scenarioIdDisplay" id="oneStepScenarioLink" style="margin-right:2px;" immediate="true">
       <h:graphicImage id="oneStepScenarioImage" alt="One Step Scenario" url="/images/oneStepScenario.JPG" style="border:0"/>
       </a4j:commandLink>
      
       <a4j:commandLink action="#{searchResultsBean.exportRawResponseForASingleRecord}" style="margin-right:2px;" id="rawExportIcon">
       <h:graphicImage id="downLoadOrExport" alt="Export" url="/images/export.JPG" style="border:0"/>
       </a4j:commandLink>
      
       <a4j:commandLink action="#{searchResultsBean.editFile}" style="margin-right:2px;" rendered="#{not hit.noHit || (oneLineSearchBean.selectedDataSource=='transunion' && oneLineSearchBean.searchText != 'hit:N' && oneLineSearchBean.searchText != 'hit:n')}" id="editFileIcon">
       <h:graphicImage id="editImage" alt="Edit" url="/images/copy-edit.JPG" style="border:0"/>
       </a4j:commandLink>
      
       <a4j:commandLink action="#{scenarioRecordBean.addToScenario}" id="addToScenarioIcon" reRender="messages">
       <h:graphicImage id="addToScenarioImage" alt="Add To Scenario" url="/images/addToScenario.JPG" style="border:0"/>
       </a4j:commandLink>
       </rich:panel>
      
       <rich:panel style="border:0px;margin:0px" id="spacePanel">
       <h:outputText value=" " id="space"/>
       </rich:panel>
      
       <rich:panel style="border:0px" id="addressPanel">
       <h:panelGrid columns="1" border="0" id="addressGrid">
       <h:outputText value="#{hit.ssn}" style="font-size:xx-small" id="ssn"/>
       <h:panelGroup id="addressPanelGroup">
       <h:outputText value="#{hit.strtNum}" style="margin-right:1px;font-size:xx-small" id="streetNumber"/>
       <h:outputText value="#{hit.strtName}" style="margin-right:1px;font-size:xx-small" id="streetName"/>
       <h:outputText value="#{hit.strtType}," style="margin-right:1px;font-size:xx-small" id="streetType"/>
       <h:outputText value="#{hit.city}," style="margin-right:1px;font-size:xx-small" id="city"/>
       <h:outputText value="#{hit.state}," rendered="#{not hit.canadianAddress}" style="margin-right:1px;font-size:xx-small" id="state"/>
       <h:outputText value="#{hit.province}," rendered="#{hit.canadianAddress}" style="margin-right:1px;font-size:xx-small" id="province"/>
       <h:outputText value="#{hit.zip}" rendered="#{not hit.canadianAddress}" style="font-size:xx-small" id="zip"/>
       <h:outputText value="#{hit.postalCode}" rendered="#{hit.canadianAddress}" style="font-size:xx-small" id="postalCode"/>
       </h:panelGroup>
       </h:panelGrid>
       </rich:panel>
      
       <rich:panel id="scenarioIdDisplay" style="border:0px" rendered="#{searchResultsBean.renderScenarioId}">
       <h:outputText value="#{scenarioRecordBean.contextualIdOfTheSavedScenario}" id="contextualId"/>
       </rich:panel>
      
       <rich:panel style="border:0px;margin:0px" id="emptyPanel">
       <h:outputText value=" "/>
       </rich:panel>
      
      
       <rich:panel style="margin:0px; align:top;width:50%" id="scorePanel">
       <h:panelGrid columns="1" border="0" style="height:4px;margin:0px" bgcolor="#70A0FF" cellspacing="0" cellpadding="0" width="#{hit.scoreAsString} %" id="scoreGrid">
       <h:outputText id="hitBaer" value="">
       </h:outputText>
       </h:panelGrid>
       </rich:panel>
      
       </h:panelGrid>
       </h:column>
      
       </rich:dataTable>
      
       </rich:panel>
      
      </a4j:form>
      
      
      
      </f:view>
      
      
      </div>
      
      </body>
      </html>