You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Dennis Byrne (JIRA)" <de...@myfaces.apache.org> on 2006/01/03 06:46:04 UTC

[jira] Commented: (MYFACES-853) commandLink not working inside dataList

    [ http://issues.apache.org/jira/browse/MYFACES-853?page=comments#action_12361570 ] 

Dennis Byrne commented on MYFACES-853:
--------------------------------------

This is the same thing over in http://issues.apache.org/jira/browse/MYFACES-954 .

The children of dataList are not decoded, and any browser event (at least, for commandLinks), cannot be registered even if children were decoded :( 

HtmlDataList inherits processDecodes from UIData.  UIData.processDecodes calls methods like processFacets(), processColumnFacets() and processColumnChildren() .  All three of these methods fail to decode children such as plain commandLinks and commandButtons (which are often found below t:dataList w/out facets and columns).  Consequently, command children of dataList elements are not properly decoded during the apply request values phase.  Events for these commands are of course not registered, which is why neither action listeners nor actions are invoked in later phases.

This can be fixed by making HtmlDataList implment it's own processDecodes() w/ a simple call to getChildren() and for loop.  Decoding would be delegated to the Renderer for each child.  Normally, HtmlLinkRendererBase does this, and it queus an event whenever the clientId matches the value of the HTTP parameter _link_hidden_ .  This event would result in a method firing during the invoke application phase, provided the action source is not immediate.  However this does not happen because the UIComponent, in this case an action source, does not give the proper clientId to the renderer.  In other words, the _link_hidden_ HTTP request parameter does not match the value returned by HtmlCommandLink.getClientId() .  For example, say we have the following in a JSP ...

 <t:dataList id="dataList" var="item" value="#{UserLister.dataModel.wrappedData}" >
       <h:commandLink value="#{item}" action="#{UserCrud.retrieve}" >
             <t:updateActionListener property="#{UserCrud.id}" value="#{item.myUserId}" />
       </h:commandLink>
 </t:dataList>

After clicking in the first link, the resulting HTTP parameter value for _link_hidden_ ends up being dataList_0:_idJsp3.  This is correct, but the link renderer is looking for dataList:_idJsp3 ( see HtmlLinkRendererBase.decode() ).  This means HtmlDataList.getClientId() ( I am not in favor of changing clientId implementation for action sources) may also have to be changed.  

I have not stepped through this w/ commandButton.

Can anyone point me to info on HtmlDataTableHack ?

> commandLink not working inside dataList
> ---------------------------------------
>
>          Key: MYFACES-853
>          URL: http://issues.apache.org/jira/browse/MYFACES-853
>      Project: MyFaces
>         Type: Bug
>     Versions: 1.1.1
>  Environment: WinXP,tomcat 5.5.9,myfaces-1.1.1,JDK 1.5
>     Reporter: Alexander Traeder

>
> in following code fragement  the action-method "testService.listenOnSelect" is never called:
> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
> <%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
> <f:subview id="test">
> 		<h:form id="testform">
> 			<h:panelGrid columns="1">
> 				<t:dataList id="datalist" style="standardList"
>         					var="test"
>         					value="#{testService.entries}"
>         			                rowCountVar="rowCount"
> 					        rowIndexVar="rowIndex"
> 					        layout="unorderedList">
>     				        <h:commandLink id="test_ref" value="#{rowIndex + 1}" action="#{testService.listenOnSelect}" />       					
> 				</t:dataList>
> 			</h:panelGrid>
> 		</h:form>
> </f:subview>
> after some testing i also tried the nightly build but with the same result
> also tried the following (working in other scenarios):
>     				<h:commandLink id="testref" immediate="true" value="#{rowIndex + 1}" action=""> 
>     					<t:updateActionListener property="#{rowCount}" value="#{testService.searchRow}" />
>     				</h:commandLink>
> any ideas?

-- 
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