You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Mike Meessen (JIRA)" <de...@myfaces.apache.org> on 2006/11/22 15:05:02 UTC

[jira] Created: (TOMAHAWK-794) Synchronization problem when restoring preserved data model

Synchronization problem when restoring preserved data model
-----------------------------------------------------------

                 Key: TOMAHAWK-794
                 URL: http://issues.apache.org/jira/browse/TOMAHAWK-794
             Project: MyFaces Tomahawk
          Issue Type: Bug
          Components: Extended Datatable
    Affects Versions: 1.1.3
            Reporter: Mike Meessen


Hi,

At first, I'd like to say that this issue report could be normal behavior, maybe I am doing something wrong here but I rather think it is a problem in the extended data table.

Here is some context information to understand my problem:

I have a t:dataTable bound to a dataModel in a backing bean (value=#{actionBean.dataModel}). Initially, this dataModel is filled with data from a database. Since the state of my database could change between two requests, I'm using preserveDataModel="true". The idea is that the dataModel only gets updated by explicitely calling an appropriate "update" method (#{actionBean.update}) in the "Invoke application logic" lifecycle phase so, afterwards, the "Render response" phase would have the fresh data to display.

Now, the following is a bit tricky:
On each row, there is a commandButton, rendered or not depending on the value of a field of the row. So let's say I have a list of cars with their state displayed. If the state is "Assembling parts..." no commandButton is displayed but if the state is "Ready", there should be a command button "Buy" allowing to buy the newly assembled car.

My approach was to use the "rendered" attribute of the corresponding "Buy" commandButton as follows:
rendered="#{actionBean.currentCarReady}"
So I have the method "isCurrentCarReady" on my actionBean. This method is actually quite simple:
----------------
Car currentCar = (Car) this.getDataModel().getRowData();
return currentCar.getState() == "Assembling parts..." ? false : true;
----------------

So what happens next?

The initial request is allright, but when I click the "Buy" commandButton, the call "this.getDataModel().getRowData()" fails. Debugging shows that getRowIndex() of my dataModel always is '-1' (throught the entire iteration over the t:dataTable in the "restore" phase of the second request).

Is that an error in the t:dataTable not setting the dataModel back to the backing bean at the right time? Could the t:dataTable restore the dataModel prior to restoring it's children or is that technicallt impossible?

.... or ...

Am I doing something wrong?

I apologize to post an issue with such a vague description, but I've been trying for two days now and can't really find a working solution...

Regards,
Mike Meessen

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira