3 Replies Latest reply on Jan 7, 2008 3:18 PM by Steve Whatmore

    Can't figure out simple method call per row of table

    David M. Karr Newbie

      JSF 1.1, RichFaces 3.1.3, WebLogic 9.2.2.

      I'm trying to figure out something that should be simple. I have a datatable, and each row has a link to perform an action relative to the clicked row. Somehow, the action method needs to know what row the action was relative to.

      The top of my datatable looks like this:

      <rich:dataTable id="projectsTable" value="#{projectManager.projects}" title="Projects" var="project" columns="2" frame="border" rules="all" rowKeyVar="rowNum">


      The column that defines the row-relative link is:

      <rich:column>
       <f:facet name="header"><h:outputText value="Add"/></f:facet>
       <a4j:commandLink action="#{projectManager.addProject}" reRender="projectsTable" value="Add">
       <f:param name="rowNum" value="#{rowNum}"/>
       </a4j:commandLink>
      </rich:column>


      When I click the link, I see lots of debug on the console showing the data populated in the table, but it never calls my action method.

      If it matters, my action method is just this:

      public void addProject()
       {
       String rowNumStr =
       (String) FacesContext.getCurrentInstance().getExternalContext().
       getRequestParameterMap().get("rowNum");
       int rowNum = Integer.parseInt(rowNumStr);
       getProjects().add(rowNum, new ProjectBean());
       }


      Any suggestions?