[ 
https://issues.apache.org/jira/browse/MYFACES-1109?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12474659
 ] 

Mathias Broekelmann commented on MYFACES-1109:
----------------------------------------------

I can't see how we can fix this in h:datatable for jsf 1.1 or 1.2. The spec 
clearly states what should happen if a UIData component encodeBegin method is 
called:

In addition to the default behavior, ensure that any saved per-row state for 
our child input components is discarded unless it is needed to rerender the 
current page with errors.

see Javadoc for 1.1: 
http://java.sun.com/javaee/javaserverfaces/1.1_01/docs/api/javax/faces/component/UIData.html#encodeBegin(javax.faces.context.FacesContext)
 
see Javadoc for 1.2: 
http://java.sun.com/javaee/javaserverfaces/1.2/docs/api/javax/faces/component/UIData.html#encodeBegin(javax.faces.context.FacesContext)

There is an important reason why this must be handled in this way . The invoked 
action could modify the datamodel source in a way which is not compatible to 
the saved state. For instance if an action removes a row in the dataset and the 
per- row state is not discarded restoring the state will either produce currupt 
rendering or will result in an exception. There is no link between a row in the 
datamodel and it's saved state but the row index.

But I think it should be able to add that support to t:datatable.

> UIInputs in DataTable (UIData) lose submitted values when UICommands are set 
> to immediate=true
> ----------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-1109
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1109
>             Project: MyFaces Core
>          Issue Type: Bug
>          Components: General, JSR-252
>    Affects Versions: 1.1.0, 1.1.1, 1.1.2-SNAPSHOT, 1.1.2, 1.1.3
>            Reporter: David Green
>         Attachments: FaceletsTestExampleByMikeKienenberger.zip, 
> TestExampleByDavidGreen.zip
>
>
> Similar to MYFACES-335, DataTable values do not reflect a form submission is 
> an action is performed with immediate=true
> Perform the following actions:
> Failure Scenario:
> 1. load the page in your browser Test.jsp
> 2. Press the "Add" button once to add a row to the data table.
> 3. Enter some data in the text field in the added row.
> 4. Press "Add" again to add a second row to the data table.
> 5. Notice that the rendered page now has two rows in the data table, however 
> text entered into the text field in the first row is now lost.
> Success Scenario:
> 1. Repeat steps 1 to 4 of the failure scenario (above).
> 2. Now press "Delete" on the second row in the data table.
> 3. Notice that the rendered page now has only one row and it is containing 
> text entered in step 3 as expected.
> This test confirms that data tables work as expected when immediate=true is 
> not used, but that data tables fail to work as expected when immediate=true 
> is used.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to