4 Replies Latest reply on Feb 16, 2009 4:28 AM by Koray Cetinbas

    rich:datatable rendering problem for a4j:commandLinks

    Koray Cetinbas Newbie


      I have an application using richfaces 3.3.0, jsf 1.2 and tomcat 6.0 (actually i am using jboss portal but the problem can be reproduced with tomcat or glassfish as well. I used to think the problem was somehow related to portlet bridge but it seems that it is not)

      I used to see this problem on previous versions of richfaces but i suppose the problem still exists (at least for me)

      Currently what i am trying to do is to render a rich:dataTable using a a4j:commandLink. The datatable includes a4j:commandLinks. Here is what i am trying to do.

      the jsp page is:

       <h:outputText value="Search Screen" />
       <a4j:commandButton value="Search" action="#{searchBean.search}"/>
      <h:panelGrid rendered="#{searchBean.displaySearchResults}">
       <a4j:form id="resultTable">
       <rich:dataTable value="#{searchBean.searchResults}" var="iter">
       <f:facet name="header">
       <h:outputText value="Name" />
       <a4j:commandLink value="#{iter}" action="#{searchBean.select}"/>

      Datatable is not rendered at initial load.
      Backing bean code is

       private boolean displaySearchResults = false;
       private String[] searchResults = null;
       public String[] getSearchResults() {
       return searchResults;
       public void setSearchResults(String[] searchResults) {
       this.searchResults = searchResults;
       public boolean isDisplaySearchResults() {
       return displaySearchResults;
       public void setDisplaySearchResults(boolean displaySearchResults) {
       this.displaySearchResults = displaySearchResults;
       public void search(){
       searchResults = new String[3];
       searchResults[0] = "firstResult";
       searchResults[1] = "secondResult";
       searchResults[2] = "thirdResult";
       System.out.println("Search button clicked!");
       //return "index";
       public void select(){
       System.out.println("Result selected!");
       private void navigateAndRerender(String path)
       FacesContext facesContext = FacesContext.getCurrentInstance();
       Application application = facesContext.getApplication();
       NavigationHandler navigationHandler = application.getNavigationHandler();
       navigationHandler.handleNavigation(facesContext, null, path);

      i have seen that, if i do not render at least one row for rich:dataTable at the initial load of the page, no matter what i do (use reRender for commandButton, or force reRendering for the whole page like navigateAndReRender method above or making ajax call generate a jsf response) i can not make a4j:commandLinks work inside the table. Rendering an empty table does not also work.

      I have also tried giving unique ids to all components, using h:columns, using h:form etc. but none of them did the trick.

      When i click the command link, an ajax request is sent to the server (i have verified it by writing my own a4j filter) but backing bean method is not triggered.

      I have looked a lot around previous related forum topics and jira bugs but i suppose the mentioned similar problems are not the same as mine.

      Is what i am trying to do something what i should not try to do?
      Could you please help me with what i am doing wrong?
      I must be missing something somewhere