Reputation: 115
I have this Table:
.divTable{
display: table;
width: 50%;
padding-top: 100px;
padding-left: 100px;
margin-left: auto;
margin-right: auto;
}
.divTableRow {
display: table-row;
}
.divTableHeading {
background-color: #EEE;
display: table-header-group;
}
.divTableCell, .divTableHead {
border: 1px solid #999999;
display: table-cell;
padding: 3px 10px;
background-color: #ffffff;
width: 50%;
}
.divTableHeading {
background-color: #EEE;
display: table-header-group;
font-weight: bold;
width: 100%;
}
.divTableFoot {
background-color: #EEE;
display: table-footer-group;
font-weight: bold;
}
.divTableBody {
display: table-row-group;
}
<div class="divTable">
<div class="divTableBody">
<ui:repeat var="customerInList" value="#{customerListController.resultMap.currentPositionResultList}"> <div class="divTableRow">
<div class="divTableCell">#{customerInList.lastName} #{customerInList.firstName}</div>
<div class="divTableCell">#{customerInList.postalStreet}
<p:commandButton id="editCustomerButton" label="+" iconPos="center" onclick="PF('editCustomerDialog').show()"/>
<br/>#{customerInList.postalCode} #{customerInList.postalCity}
<br/>#{customerInList.phoneNumber}
<br/>#{customerInList.email}
</div>
</div>
</ui:repeat>
</div>
</div>
<p:dialog widgetVar="editCustomerDialog">
</p:dialog>
And this Method
public void parseParameter(int ID){
this.ID = ID;
}
so here comes my problem. As you can maybe already see I am trying to create a Popup to show more details about the customer. My Idea was that I could parse the Id of the customer from an Invisible div or something like this so I can get the remaining data from my database with this ID but that did not work for me.
Is there any other way to do this ?
Upvotes: 2
Views: 2318
Reputation: 1436
You can use a f:setPropertyActionListener
to set values to your bean from your p:commandButton
then use the action
event of your button to get any extra data from your DB and you can show your dialog on the oncomplete
event instead of onclick
so it get execute after your bean method.
<p:commandButton id="editCustomerButton" label="+" iconPos="center" action="#{customerListController.methodToGetYourRemainingData}" oncomplete="PF('editCustomerDialog').show()">
<f:setPropertyActionListener target="#{customerListController.ID}" value="#{customerInList.ID}" />
</p:commandButton>
Upvotes: 2