[richfaces-issues] [JBoss JIRA] (RF-13165) The rowclick event of the rich:dataTable is not recognized as a valid server-side event during an ajax postback

Brian Leathem (JIRA) jira-events at lists.jboss.org
Tue Sep 3 16:12:03 EDT 2013


    [ https://issues.jboss.org/browse/RF-13165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12801326#comment-12801326 ] 

Brian Leathem commented on RF-13165:
------------------------------------

To generalize the fix, the server-side check could check if the originating element id is a valid metacomponent id for the targeted component.
                
> The rowclick event of the rich:dataTable is not recognized as a valid server-side event during an ajax postback
> ---------------------------------------------------------------------------------------------------------------
>
>                 Key: RF-13165
>                 URL: https://issues.jboss.org/browse/RF-13165
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>          Components: component-tables
>            Reporter: Brian Leathem
>             Fix For: 5-Tracking
>
>
> An embedded _<a4j:ajax>_ tag in an extendedDataTable with the event rowclick_ does not work.  The relevant code snippet:
> {code}
> <a4j:ajax event="rowclick" render="shippingEditForm" listener="#{shippingEdit.setId(shipping.id)}"/>
> {code}
> This *should* work. A google search quickly shows one how many people expect it to work. I dug in to find out why it doesn't work:
> When a HTML element triggers an ajax event, a check is performed on the server-side to see if the HTML element that triggered the event is the JSF component that is being decoded. This is done in this line of code:
> https://github.com/richfaces/richfaces/blob/master/framework/src/main/java/org/richfaces/renderkit/RenderKitUtils.java#L511
> {code}
> if (behaviorSource != null && behaviorSource.equals(clientId)) {
> ...
> {code}
> Before the request is sent to the server, we check if the originating element of an event is from a component, and "re-target" it if not (see:RF-12616, RF-12715). This is done in these lines of code:
> https://github.com/richfaces/richfaces/blob/master/framework/src/main/resources/META-INF/resources/richfaces.js#L677
> {code}
>                 if (this.id && sourceElement.id.indexOf(this.id) == 0) { // otherwise parent element is definitely not JSF component
>                     var suffix = sourceElement.id.substring(this.id.length); // extract suffix
>                     if (suffix.match(/^[a-zA-Z]*$/) && isRichFacesComponent(this)) {
>                         parentElement = this;
>                         return false;
>                     }
>                 }
> {code}
> This re-targeting works well, as for the most part elements DOM ids within components use the _#\{clientId}Qualifier_ syntax. However this breaks down with table rows, where the ":" separator is used. This is the same separator used to separate JSF component id's in the _clientId_. For example, a table with the _clilentId_ "_form:edt_" will have rows with DOM id "_myForm:edt:5:n_".
> So we need to fix the client-side re-targeting to work for table rows.

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


More information about the richfaces-issues mailing list