This question already has an answer here:
I know you would say this question been asked before but I tried many ways and none of it did work. I have list of members data to be showing in the view as a table. each member has list of phone numbers which also i to show as a child table in that row (i am not showing it in the below codes) however, we added a column that a check box would be showing if the member has a home phone number so the worker has ability to select multi members to delete their home phone number. I have the below xhtml
<html xmlns="http://ift.tt/lH0Osb"
xmlns:ui="http://ift.tt/1g9HgFb"
xmlns:h="http://ift.tt/J1LPWj"
xmlns:f="http://ift.tt/19DXC4H"
xmlns:c="http://ift.tt/2kscbWl"
xmlns:pt="http://ift.tt/1fNVSr5">
<h:commandButton id="Cancel" value="Cancel Requestes" action="#{been.removSelected}">
<div>
<h:dataTable value="#{bean.ListOfData}" var="list">
<h:column>
<f:facet name="header">Request Type</f:facet>
#{list.id}
</h:column>
<h:column>
<f:facet name="header">Request Type</f:facet>
#{list.name}
</h:column>
<h:column>
<f:facet name="header">Remove</f:facet>
<h:form>
<c:set var="contains" value="false" />
<ui:repeat var="numbers" value="#{list.numbers}" >
<h:selectManyCheckbox value="#{bean.checkedList}" rendered="#{!contains and numbers.type == 'HOME'}">
<f:selectItem itemValue="#{list.Id}" itemLabel=""/>
<c:set var="contains" value="false" />
</h:selectManyCheckbox>
</ui:repeat>
</h:form>
</h:column>
</h:dataTable>
</div>
and the been as below
@ManagedBean(name = "bean", eager = true)
@SessionScoped
public Class Bean implements Serializable {
list<Object> ListOfData; // with setters and getters
list<Long> checkedList; // with setters and getters
Bean(){
// get checkedListfrom DB
}
public removSelected(){
// forward the ids to DB to remove the numbers
}
}
I tried many ways and never the checkedList got a value and we do not use prime faces or rich faces.
Aucun commentaire:
Enregistrer un commentaire