I am trying to provide a possibility to inline-edit a row of a datatable with primefaces, but it doesn't seem to work properly. I can visually edit the values but when I click the save-icon, it doesn't update the changed values...
Here is the code:
Datatable:
<p:dataTable id="ticketTypePrices" var="priceCategoryTicketType"
value="#{EventInstanceController.priceCategoryTicketTypes}"
editable="true">
<p:ajax event="rowEdit" update="@this" listener="#{EventInstanceController.onEditPrices}" />
<p:ajax event="rowEditCancel" listener="#{EventInstanceController.onCancelPrices}" update="@this" />
<p:column headerText="Preiskategorie">
<h:outputText value="#{priceCategoryTicketType.priceCategory.name}" />
</p:column>
<c:forEach items="#{EventInstanceController.ticketTypes}" var="item">
<p:column headerText="#{item.name}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{priceCategoryTicketType.ticketTypes[item]}" />
</f:facet>
<f:facet name="input">
<p:inputText converter="bigDecimalConverter" value="#{priceCategoryTicketType.ticketTypes[item]}" style="width:50%" />
</f:facet>
</p:cellEditor>
</p:column>
</c:forEach>
<p:column style="width:3%">
<p:rowEditor />
</p:column>
</p:dataTable>
EventInstanceController.onEditPrices
public void onEditPrices(RowEditEvent event) {
PriceCategoryTicketType pctt = (PriceCategoryTicketType)event.getObject();
System.out.println(pctt.getPriceCategory().getName());
for(int i = 0; i < priceCategoryTicketTypes.size(); i++) {
PriceCategoryTicketType pctickettype = priceCategoryTicketTypes.get(i);
if(pctt.getPriceCategory().equals(pctickettype.getPriceCategory())) {
for(Map.Entry<TicketType, BigDecimal> entry : pctt.getTicketTypes().entrySet()) {
System.out.println("TicketType: " + entry.getKey().getName());
System.out.println("Price: " + entry.getValue());
}
priceCategoryTicketTypes.set(i, pctt);
}
}
}
It looks like this:

As you can see, the default values of each cell is 0. If I change the values (like on the picture) to f.e. 30 25 20 and hit the save-row-icon, the values will change back to 0 0 0.
The System.out.println in the onEditPrices results to following:
INFO: TicketType: Standard
INFO: Price: 0
INFO: TicketType: AHV
INFO: Price: 0
INFO: TicketType: Student
INFO: Price: 0
Am I missing something? :(
Info: I'm using primefaces version 4.0 (snapshot) but also tried and failed with stable version 3.5
Thanks in advance, Xera