You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by vlad10 <iv...@yahoo.com> on 2007/06/30 21:14:19 UTC

Problem updating details in Tomahawk detailStamp dataTable

I'm encountering a strange behavior, when trying to update detail records in
tomahawk detailStamp dataTable. 
The bean method attached to the valueChangeListener gets called even so,
there is no one detail value is changed. When I display
event.getOldvalue()/.getNewValue(), it shows the new value correctly, but
the oldValue is somehow grabbed from another detail.
Here is my code and the log result (when the page was submitted and no one
detail was updated).
I have 4 details in my example. Their values are: 'ABC212',
'ABC211','ABC222','ABC221', in this exact order.

            <t:dataTable value="#{customers.list}"
               id="data"
               var="customer" 
               varDetailToggler="detailToggler"
                preserveDataModel="true"
               styleClass="customers" 
               headerClass="customersHeader" columnClasses="custid,name">
               <h:column>
                  <f:facet name="header">
                     <h:outputText value="#{msgs.customerIdHeader}"/>
                  </f:facet>
                  <h:outputText value="#{customer.custId}"/>
               </h:column>
               ... more columns....
				  <f:facet name="detailStamp">
					  <t:dataTable id="orders" cellpadding="0" cellspacing="0" border="0"
						  style="width:80%; "
						  styleClass="standardTable_Column" 
						  headerClass="customersHeader"
						  var="order" value="#{customer.customerOrder}">
						  <h:column>
							  <h:inputText value="#{order.orderNumber}" 
												  valueChangeListener="#{customers.orderChanged}"
id="orderNumber"/>
						  </h:column>
						  ..... more columns .........
					  </t:dataTable>
				  </f:facet>
            </t:dataTable>

    public void orderChanged(ValueChangeEvent e) {
        UIInput input = (UIInput)e.getComponent();

        log.debug("=====e.getOldValue() : " + e.getOldValue()+ "
e.getNewValue() : " + e.getNewValue());
        log.debug("This ORDER will update : " + input.getId() + 
                  " with the value: " + input.getValue() + " index: " + 
                  JsfUtil.getRowIndex(input)
                  + " parentIndex: "+ JsfUtil.getParentRowIndex(input)
                  + " clientID: " +
input.getClientId(FacesContext.getCurrentInstance()));

        String name = input.getId();
    }

DEBUG =====e.getOldValue() : ABC221 e.getNewValue() : ABC212
DEBUG This ORDER will update : orderNumber with the value: ABC212 index: 0
parentIndex: 1 clientID: content:form:data:1:orders:0:orderNumber
DEBUG =====e.getOldValue() : ABC212 e.getNewValue() : ABC211
DEBUG This ORDER will update : orderNumber with the value: ABC211 index: 1
parentIndex: 1 clientID: content:form:data:1:orders:1:orderNumber
DEBUG =====e.getOldValue() : ABC211 e.getNewValue() : ABC222
DEBUG This ORDER will update : orderNumber with the value: ABC222 index: 2
parentIndex: 1 clientID: content:form:data:1:orders:2:orderNumber
DEBUG =====e.getOldValue() : ABC222 e.getNewValue() : ABC221
DEBUG This ORDER will update : orderNumber with the value: ABC221 index: 3
parentIndex: 1 clientID: content:form:data:1:orders:3:orderNumber

I appreciate your input.
thanks
vlad
-- 
View this message in context: http://www.nabble.com/Problem-updating-details-in-Tomahawk-detailStamp-dataTable-tf4005743.html#a11376274
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Problem updating details in Tomahawk detailStamp dataTable

Posted by vlad10 <iv...@yahoo.com>.
I don't have this problem any more, but did not record how it got resolved.
My re-collection is that it has to do with the data sorting. 
First when you retrieve the records from DB, you must specify the order-by,
don't rely on any 'natural' order. Then in java use something like List in
your data model to preserve the 'order-by'.

vlad



Alf wrote:
> 
> 
> 
> vlad10 wrote:
>> 
>> I'm encountering a strange behavior, when trying to update detail records
>> in tomahawk detailStamp dataTable. 
>> The bean method attached to the valueChangeListener gets called even so,
>> there is no one detail value is changed. When I display
>> event.getOldvalue()/.getNewValue(), it shows the new value correctly, but
>> the oldValue is somehow grabbed from another detail.
>> 
>> I appreciate your input.
>> thanks
>> vlad
>> 
> 
> Hi Vlad,
> I encountered the same problem using Tomahawk detailStamp inside a
> datatable, in
> my code each table row has an inputTextArea component that I show and hide
> using
> detailStamp facet.
> When I submit the page ALL row-objects will be update (calling the proper
> setter
> method) with the value stored in the currently visible textarea.
> 
> I can't find any solution about this issue so I would like to know if you
> solved
> this problem or if you can suggest me some input.
> 
> Thanks 
> Alf
> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Problem-updating-details-in-Tomahawk-detailStamp-dataTable-tf4005743.html#a11709187
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Re: Problem updating details in Tomahawk detailStamp dataTable

Posted by Alf <sa...@hotmail.com>.


vlad10 wrote:
> 
> I'm encountering a strange behavior, when trying to update detail records
> in tomahawk detailStamp dataTable. 
> The bean method attached to the valueChangeListener gets called even so,
> there is no one detail value is changed. When I display
> event.getOldvalue()/.getNewValue(), it shows the new value correctly, but
> the oldValue is somehow grabbed from another detail.
> 
> I appreciate your input.
> thanks
> vlad
> 

Hi Vlad,
I encountered the same problem using Tomahawk detailStamp inside a
datatable, in
my code each table row has an inputTextArea component that I show and hide
using
detailStamp facet.
When I submit the page ALL row-objects will be update (calling the proper
setter
method) with the value stored in the currently visible textarea.

I can't find any solution about this issue so I would like to know if you
solved
this problem or if you can suggest me some input.

Thanks 
Alf



-- 
View this message in context: http://www.nabble.com/Problem-updating-details-in-Tomahawk-detailStamp-dataTable-tf4005743.html#a11705241
Sent from the MyFaces - Users mailing list archive at Nabble.com.