I have a problem when using rowEditor with Myfaces 2. Here is the page fragment:
Code: Select all
<p:dataTable var="customer" value="#{customers}">
<p:column headerText="First Name">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{customer.firstName}"/>
</f:facet>
<f:facet name="input">
<p:inputText value="#{customer.firstName}" required="true"/>
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="Options">
<p:rowEditor/>
</p:column>
</p:dataTable>
- Assume #{customers} have 3 items: [Peter, Paul, Mary]. Click the second Row Edit button, i.e. Paul
- Change 'Paul' to 'David' in the firstName field and click the Row Save button
After investigation, the cause could be in the request parameter javax.faces.source generated by the doRowEditRequest function in datatable.js.
Code: Select all
PrimeFaces.widget.DataTable.prototype.doRowEditRequest = function(element, action) {
var row = $(element).parents('tr').eq(0),
options = {
source: this.id,
update: this.id,
formId: this.cfg.formId
},
...
Code: Select all
if(action === 'save') {
//Only process cell editors of current row
var editorsToProcess = new Array();
row.find('span.ui-cell-editor').each(function() {
editorsToProcess.push($(this).attr('id'));
});
options.process = editorsToProcess.join(' ');
options.source = rowEditorId;
}