myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leonardo Uribe (JIRA)" <...@myfaces.apache.org>
Subject [jira] [Commented] (TOMAHAWK-1661) dataTable value evaluated if parent component not rendered if preserveDataModel is true
Date Thu, 28 Mar 2013 18:03:15 GMT

    [ https://issues.apache.org/jira/browse/TOMAHAWK-1661?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13616480#comment-13616480
] 

Leonardo Uribe commented on TOMAHAWK-1661:
------------------------------------------

preserveDataModel forces save the dataModel into the state, and in that way, getValue() must
be called. There is no way to avoid this, because "rendered" attribute has nothing to do with
the state saving algorithm.

I can see the logic behind this. If the component is not rendered, there should not be dataModel
to store and in that way getValue() does not need to be called. Only if there is a dataModel
before save state, it has sense to save it.

I think the solution could be check if there is a dataModel and preserveDataModel is active
save it, otherwise do not do nothing. 

Thinking about this, I realized that in case of a nested dataTable with preserveDataModel
set to true, it is better that the inner declaration does not have any effect, because the
top level dataModel contains the information of the inner dataModel too. 
                
> dataTable value evaluated if parent component not rendered if preserveDataModel is true
> ---------------------------------------------------------------------------------------
>
>                 Key: TOMAHAWK-1661
>                 URL: https://issues.apache.org/jira/browse/TOMAHAWK-1661
>             Project: MyFaces Tomahawk
>          Issue Type: Bug
>    Affects Versions: 1.1.14
>            Reporter: John Smith
>
> If a t:dataTable's parent component's rendered attribute evaluates to false, the dataTable's
value attribute is still evaluated if the dataTable has the preserveDataModel attribute set
to true.
> While I don't think this strictly violates the spec (it says under 2.2.6: 'If the isRendered()
method of a component returns false, the renderer for that component must not generate any
markup, and none of its facets or children (if any) should be rendered.'), it is at the very
least inconsistent with other JSF components, which do not evaluate the value if not rendered
> Example:
> <html xmlns="http://www.w3.org/1999/xhtml"
> 	  xmlns:h="http://java.sun.com/jsf/html"
> 	  xmlns:t="http://myfaces.apache.org/tomahawk" >
> 	<h:head />
> 	<h:body>
> 		<h:form>
> 			<h:panelGroup rendered="false">
> 				<t:dataTable value="#{bean.list}" var="list" preserveDataModel="true" >
> 					<h:column>#{list}</h:column>
> 				</t:dataTable>
> 			</h:panelGroup>
> 			</h:form>
> 	</h:body>
> </html>
> -------------------------------------------------
> @RequestScoped
> @ManagedBean
> public class Bean {
> 	public List<String> getList(){
> 		throw new RuntimeException("this should not be called");
> 	}
> }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message