Primefaces p:celleditor celledit

jsfjsf-2primefaces

I'm implementing a p:dataTable component, based on the Primefaces Showcase

The code is:

<p:dataTable
    id="newDataTable"
    editable="true"
    editMode="cell"
    var="item"
    value="#{myBean.listNewDataTable}">

    <p:ajax event="cellEdit" listener="#{myBean.newCellEditListener}" update="@this"/>
    <p:column width="150" >
        <p:cellEditor>
            <f:facet name="output">
                <h:inputText value="#{item.description}" readonly="true"/>
            </f:facet>
            <f:facet name="input">
                <p:selectOneMenu value="#{item.id}" style="width: 90%;">
                    <f:selectItems value="#{myBean.productsMap.entrySet()}" var="entry" itemValue="#{entry.key}" itemLabel="#{entry.value}" />
                </p:selectOneMenu>
            </f:facet>
        </p:cellEditor>
    </p:column>
    -- More Data --
</p:dataTable>

And the backing bean method:

public void newCellEditListener(CellEditEvent event){
    ... Some work here ...
}

When the value on the editable cell is changed, the p:cellEditor works as expected.

The problem is:

When the value on the editable cell remains unchanged, the p:cellEditor shows the item.id when it should actually be showing the item.description.

Am I missing something obvious? Do I need additional configuration?

I have been googling for a tip or an answer, without success.

UPDATE

Same problem persists on the following code:

<p:column headerText="Money" width="150" >
    <p:cellEditor >
        <f:facet name="output">
            <h:inputText value="#{actual.money}" readonly="true">
                <f:convertNumber type="currency" />
            </h:inputText>
        </f:facet>
        <f:facet name="input">
            <h:inputText value="#{actual.money}">
            </h:inputText>
        </f:facet>
    </p:cellEditor>
</p:column>

The value on the backing bean its the same for input and output, the difference between each other should be the 'currency' format.

UPDATE

As a workaround I used "p:commandButton" to update the Datatable.

<p:commandButton icon="ui-icon-refresh" update="newDataTable" value="Update" />

The app is running on:

  • Primefaces 3.5
  • Primefaces Extensions 0.7.1
  • Mojarra 2.1.22
  • Tomcat 7

Thanks for your help.
Kind regards.

Best Answer

Values in output and input should be the same. Try to fix that.

Related Topic