You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Michael Dietrich (Created) (JIRA)" <de...@myfaces.apache.org> on 2011/11/04 08:37:00 UTC

[jira] [Created] (MYFACES-3385) Entered values for input fields conatined in a Composite Component are lost, if the CC is used in a datatable

Entered values for input fields conatined in a Composite Component are lost, if the CC is used in a datatable
-------------------------------------------------------------------------------------------------------------

                 Key: MYFACES-3385
                 URL: https://issues.apache.org/jira/browse/MYFACES-3385
             Project: MyFaces Core
          Issue Type: Bug
    Affects Versions: 2.1.2
            Reporter: Michael Dietrich
         Attachments: MyFacesCCUIData212Test.war

Assume, a Composite Component contains input fields, i.e any subclass of EditableValueHolder (e.g. inputText, inputTextarea, ..). If this CC is than used in a subclass of UIData, e.g. a dataTable, the values entered in the CCs input fields get lost (despite for the last row in the Model of the UIData object).

This seems to be related to the fact how the method "saveDescendantComponentStates(..)" of the UIData class checks, if a component has childs, whos state must be saved, before changing the rowIndex. The mentioned method only checks "child.getChildCount() > 0", but getChildCount() is 0 for a CC. I assume it would be necessary to check the FacetCount for a CC instead. 

The attached WAR file can help to reproduce the issue with a simple example.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (MYFACES-3385) Entered values for input fields conatined in a Composite Component are lost, if the CC is used in a datatable

Posted by "Keith Wong (Commented) (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-3385?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13146744#comment-13146744 ] 

Keith Wong commented on MYFACES-3385:
-------------------------------------

I want to make a note that this issue also affects the components that using facets to store input components such as <p:cellEditor> of PrimeFaces.  For example,

    <p:dataTable var="customer" value="#{customers}">
        <p:column headerText="First Name">
            <p:cellEditor>
                <f:facet name="output">
                    <h:outputText value="#{customer.firstName}"/>
                </f:facet>
                <f:facet name="input">
                    <p:inputText value="#{customer.firstName}"/>
                </f:facet>
            </p:cellEditor>
        </p:column>

        <p:column headerText="Options">
            <p:rowEditor/>
        </p:column>
    </p:dataTable>

In this case, the first row is always be overwritten by the last row whatever which row is editing.  See http://forum.primefaces.org/viewtopic.php?f=3&t=15349 for further discussion.
                
> Entered values for input fields conatined in a Composite Component are lost, if the CC is used in a datatable
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-3385
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3385
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.1.2
>            Reporter: Michael Dietrich
>            Assignee: Leonardo Uribe
>            Priority: Critical
>             Fix For: 2.0.10, 2.1.4
>
>         Attachments: MYFACES-3385-1.patch, MyFacesCCUIData212Test.war
>
>
> Assume, a Composite Component contains input fields, i.e any subclass of EditableValueHolder (e.g. inputText, inputTextarea, ..). If this CC is than used in a subclass of UIData, e.g. a dataTable, the values entered in the CCs input fields get lost (despite for the last row in the Model of the UIData object).
> This seems to be related to the fact how the method "saveDescendantComponentStates(..)" of the UIData class checks, if a component has childs, whos state must be saved, before changing the rowIndex. The mentioned method only checks "child.getChildCount() > 0", but getChildCount() is 0 for a CC. I assume it would be necessary to check the FacetCount for a CC instead. 
> The attached WAR file can help to reproduce the issue with a simple example.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Resolved] (MYFACES-3385) Entered values for input fields conatined in a Composite Component are lost, if the CC is used in a datatable

Posted by "Leonardo Uribe (Resolved) (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-3385?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Leonardo Uribe resolved MYFACES-3385.
-------------------------------------

       Resolution: Fixed
    Fix Version/s: 2.1.4
                   2.0.10
         Assignee: Leonardo Uribe

Many thanks for the example webapp. It makes easier and faster debug this issue. In the optimization done over UIData, it seems this condition was not taken into account, but fortunately the fix is simple. I have attached a patch and committed the solution.
                
> Entered values for input fields conatined in a Composite Component are lost, if the CC is used in a datatable
> -------------------------------------------------------------------------------------------------------------
>
>                 Key: MYFACES-3385
>                 URL: https://issues.apache.org/jira/browse/MYFACES-3385
>             Project: MyFaces Core
>          Issue Type: Bug
>    Affects Versions: 2.1.2
>            Reporter: Michael Dietrich
>            Assignee: Leonardo Uribe
>             Fix For: 2.0.10, 2.1.4
>
>         Attachments: MYFACES-3385-1.patch, MyFacesCCUIData212Test.war
>
>
> Assume, a Composite Component contains input fields, i.e any subclass of EditableValueHolder (e.g. inputText, inputTextarea, ..). If this CC is than used in a subclass of UIData, e.g. a dataTable, the values entered in the CCs input fields get lost (despite for the last row in the Model of the UIData object).
> This seems to be related to the fact how the method "saveDescendantComponentStates(..)" of the UIData class checks, if a component has childs, whos state must be saved, before changing the rowIndex. The mentioned method only checks "child.getChildCount() > 0", but getChildCount() is 0 for a CC. I assume it would be necessary to check the FacetCount for a CC instead. 
> The attached WAR file can help to reproduce the issue with a simple example.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira