Command Buttons in <rich:dataTable>
deibys Jan 24, 2008 4:04 PMHello guys ,
I am posting again, to provide more information.... I have the following code:
<rich:dataTable id="prospectoTable" value="#{SearchProspecto.prospectoItems}"
var="prospecto" rowKeyVar="index"
onRowMouseOver="this.style.backgroundColor='#FFE4E1'"
onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" >
<h:column>
<f:facet name="header">
<h:outputText value="#" />
</f:facet>
<h:outputText value="#{index+1}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Identificacion" />
</f:facet>
<h:outputText value="#{prospecto.identificacion}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Nombre" />
</f:facet>
<h:outputText value="#{prospecto.fullName}" />
</h:column>
<h:column>
<h:form>
<a4j:commandButton immediate="true" value="Editar" action="#{SearchProspecto.editar}" >
<a4j:actionparam name="prospectoIdSelected" assignTo="#{SearchProspecto.prospectoIdSelected}" value="#{prospecto.id}" />
</a4j:commandButton>
</h:form>
</h:column>
<%--
<rich:componentControl event="onRowDblClick" for="propectoDetails" operation="show">
<f:param value="#{prospecto.id}" name="prospectoId" />
</rich:componentControl>
--%>
</rich:dataTable>I have a command button for every row in the table.... When clicked it should navigate to another page through an ajax request.
The code in the backing bean is:
public String editar() throws NamingException, SQLException {
System.out.println("prospecto_id="+prospectoIdSelected);
Prospecto prospecto = Prospecto.getProspectoById(prospectoIdSelected);
FacesUtil.setRequestMapValue("prospecto", prospecto);
if (prospecto.getTipoCliente() == 1) {
System.out.println("editar_empresarial");
return "editar_empresarial";
} else {
System.out.println("editar_individual");
return "editar_individual";
}
}
The issue I have ...it is that action bean method gets executed by navigation rules are not applied.......... I have in faces-config.xml
<navigation-rule> <from-view-id>/Prospectacion/searchProspecto.jsp</from-view-id> <navigation-case> <from-outcome>editar_empresarial</from-outcome> <to-view-id>/Prospectacion/editProspecto_e.jsp</to-view-id> </navigation-case> <navigation-case> <from-outcome>editar_individual</from-outcome> <to-view-id>/Prospectacion/editProspecto_i.jsp</to-view-id> </navigation-case> </navigation-rule>
Please provide me with some information:
I have already done some ajax navigations just exactly like the example in the demo:http://livedemo.exadel.com/richfaces-demo/richfaces/include.jsf?c=include
But is there any issue if commandButton is placed inside dataTables ?
I have tried to put the form outside the <rich:datatable> and it does not work either .....
deibys