Note that there are some explanatory texts on larger screens.

plurals
  1. POSeam: Trouble updating data in h:inputText in a row of rich:dataTable
    primarykey
    data
    text
    <p>I'm trying to build an editable table to enter values of a buy order detail. I have a rich:datatable bound to a List, and I dinamically add rows to the table by adding elements to the list. The entity has two fields that must be entered manually so I'm using h:inputTexts to do it, but the values that are entered on those fields are not being saved to the objects in the list. I tried to do this with a rich:inplaceInput too(following the exact instructions on the Exadel Richfaces livedemo), to no avail. This is my code:</p> <pre><code> &lt;rich:panel&gt; &lt;f:facet name="header"&gt;#{messages.DetalleOrdenCompra}&lt;/f:facet&gt; &lt;h:outputLabel value="#{messages.Codigo}" for="txtCodigo" /&gt; #{' '} &lt;h:inputText id="txtCodigo"&gt; &lt;rich:suggestionbox id="suggestionBox" for="txtCodigo" var="consumible" fetchValue="#{consumible.conNombre}" suggestionAction="#{ordenCompraHome.autoComplete}" minChars="1" reRender="tablaDetOrdComp" ignoreDupResponses="true" bypassUpdates="false"&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt;#{messages.Codigo}&lt;/f:facet&gt; &lt;h:outputText value="#{consumible.conNumber}" /&gt; &lt;/h:column&gt; &lt;h:column&gt; &lt;f:facet name="header"&gt;#{messages.Descripcion}&lt;/f:facet&gt; &lt;h:outputText value="#{consumible.conNombre}" /&gt; &lt;/h:column&gt; &lt;a:support event="onselect" immediate="true" ignoreDupResponses="true" bypassUpdates="false"&gt; &lt;f:setPropertyActionListener value="#{consumible}" target="#{ordenCompraHome.conActual}" /&gt; &lt;/a:support&gt; &lt;/rich:suggestionbox&gt; &lt;/h:inputText&gt; #{' '} &lt;!-- Add elements to the list --&gt; &lt;a:commandButton type="button" value="#{messages.Agregar}" action="#{ordenCompraHome.anadirSeleccionadoADetalle()}" reRender="tablaDetOrdComp" immediate="true" /&gt; &lt;!-- Hitting this button after entering any values in the table below shows that the values are never updated --&gt; &lt;a:commandButton type="button" value="Refrescar tabla" reRender="tablaDetOrdComp" immediate="true" /&gt; &lt;br /&gt; &lt;br /&gt; &lt;rich:dataTable value="#{ordenCompraHome.detalleOrdenCompra}" var="detOrdComp" id="tablaDetOrdComp" rowKeyVar="row"&gt; &lt;rich:column width="5%"&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="#"&gt;&lt;/h:outputText&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{row+1}"&gt;&lt;/h:outputText&gt; &lt;/rich:column&gt; &lt;!-- ... more columns, just data output --&gt; &lt;!-- The two following columns are user inputs -- no updates in the underlying list when entering any value, both values are always null --&gt; &lt;rich:column width="10%"&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="#{messages.Cantidad}"&gt;&lt;/h:outputText&gt; &lt;/f:facet&gt; &lt;s:decorate template="layout/edit-nolabel.xhtml"&gt; &lt;h:inputText value="#{detOrdComp.ordCantidad}" id="txtCantidad" required="true"&gt; &lt;!-- tried with both events, onblur and onviewactivated, first each on on its own, then both together, no results --&gt; &lt;a:support event="onblur" reRender="columnaMonto" immediate="true" bypassUpdates="false" ajaxSingle="true" /&gt; &lt;a:support event="onviewactivated" reRender="columnaMonto" immediate="true" bypassUpdates="false" ajaxSingle="true" /&gt; &lt;/h:inputText&gt; &lt;/s:decorate&gt; &lt;/rich:column&gt; &lt;rich:column width="10%"&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="#{messages.CostoUnitario}"&gt;&lt;/h:outputText&gt; &lt;/f:facet&gt; &lt;s:decorate template="layout/edit-nolabel.xhtml"&gt; &lt;h:inputText value="#{detOrdComp.ordCostoUnitario}" id="txtCostoUnitario" required="true"&gt; &lt;a:support event="onblur" reRender="columnaMonto" immediate="true" bypassUpdates="false" ajaxSingle="true" /&gt; &lt;a:support event="onviewactivated" reRender="columnaMonto" immediate="true" bypassUpdates="false" ajaxSingle="true" /&gt; &lt;/h:inputText&gt; &lt;/s:decorate&gt; &lt;/rich:column&gt; &lt;!-- This column is the result of a multiplication between txtCantidad and txtCostoUnitario -- I don't get anything here since both factors are null (null values have been properly handled so 0.0 is displayed when any of the factors is null) --&gt; &lt;rich:column id="columnaMonto" width="10%"&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="#{messages.Monto}"&gt;&lt;/h:outputText&gt; &lt;/f:facet&gt; &lt;h:outputText value="#{detOrdComp.ordSubparcial}"&gt;&lt;/h:outputText&gt; &lt;/rich:column&gt; &lt;/rich:dataTable&gt; </code></pre> <p>Bean:</p> <pre><code>// Underlying list. I used just @DataModel, then @DataModel(scope = ScopeType.PAGE), no results @DataModel(scope = ScopeType.PAGE) public List&lt;OrdenCompraDetalle&gt; getDetalleOrdenCompra() { return detalleOrdenCompra; } </code></pre> <p>Instead of the s:decorates I was using something like this before (from the Livedemo), but it didn't work, either</p> <pre><code>&lt;rich:dataTable value="#{dataTableScrollerBean.allCars}" var="car" width="350px" columnClasses=",columns,columns,columns" rows="15" id="table" rowKeyVar="row"&gt; &lt;rich:column&gt; &lt;f:facet name="header"&gt; &lt;h:outputText value="Price" /&gt; &lt;/f:facet&gt; &lt;rich:inplaceInput layout="block" value="#{car.price}" id="inplace" required="true" selectOnEdit="true" editEvent="ondblclick"&gt; &lt;a4j:support event="onviewactivated" reRender="table, messages"/&gt; &lt;/rich:inplaceInput&gt; &lt;/rich:column&gt; </code></pre> <p></p> <p>What am I missing here? Any help would be appreciated. Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload