I have an ajax request which outputs me a dataTable and form each row i also want to execute a button.Sadly no event gets invoked and i think it is because the second button is on a different level than the first search button. JSF looks something like that:
<h:from>
<h:inputText id="search"
value="#{profileController.searchName}"/>
<h:commandButton value="Search by name"
action="#{profileController.searchProfileWithName(profileController.searchName)}">
<f:ajax execute="search"
render="output">
</f:ajax>
</h:commandButton>
<h:dataTable id="output"
value="#{profileController.searchResultList}"
var="p">
<h:column>
<f:facet name="header">Name</f:facet>
<h:outputText value="#{p.name}"/>
</h:column>
<h:column>
<f:facet name="header">Action</f:facet>
<h:commandButton value="Invite"
action="#{trainingController.inviteProfile(p)}">
<f:ajax/>
</h:commandButton>
</h:column>
</h:dataTable
</h:form>
JSF Managed Bean (requestScoped):
public String searchProfileWithName(String name) {
searchResultList = profileBean.findProfilesWithName(name);
return null;
}
ProfileBean (stateless):
public List<Profile> findProfilesWithName(String name) {
Query query = em.createNamedQuery("findProfilesWithName");
query.setParameter("name", "%" + name.replace(" ", "%") + "%");
return query.getResultList();
}
Anyone ideas in this?