[richfaces-issues] [JBoss JIRA] (RF-12986) Rich:datatable selects the wrong object when working with rich:datascroller and selectable row

Raphael Lacerda (JIRA) jira-events at lists.jboss.org
Wed May 15 14:43:06 EDT 2013


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

Raphael Lacerda commented on RF-12986:
--------------------------------------

I've found out a possible workaround that involves basically to bind the rich:dataTable and the rich:dataScroller using binding attribute with elements in the @ManagedBean

So, the a4j event would be

{code:xml}
<a4j:ajax event="rowclick"
 listener="#{test.dataTableListener()}" render="@form" />
{code} 

and the @ManagedBean 

{code:java}
public void dataTableListener() {

		int actualRowIndex = dataTable.getRowIndex()
				+ (dataTable.getRows() * (dataScroller.getPage() - 1));

		dataTable.setRowKey(actualRowIndex);

		selectedItem = (String) dataTable.getRowData();
}
{code}
                
> Rich:datatable selects the wrong object when working with rich:datascroller and selectable row
> ----------------------------------------------------------------------------------------------
>
>                 Key: RF-12986
>                 URL: https://issues.jboss.org/browse/RF-12986
>             Project: RichFaces
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 4.3.1
>         Environment: Richfaces 4.3.1 - JSF 2 - Tomcat 7+ Chrome
>            Reporter: Raphael Lacerda
>
> The example shows the using of a *rich:datable* to list Strings from a @ManagedBean.
> The goal is to click at a specific row and display the selected element.
> {code:xml} 
> <h:form>
>   <rich:dataTable value="#{test.names}" var="n" rows="4">
>          <a4j:ajax event="rowclick" listener="#{test.setSelectedItem(n)}" render="@form" />                                        
>        <rich:column>
>             <f:facet name="header">Names</f:facet>
>             <h:outputText value="#{n}" />
>         </rich:column>
>  
>         <f:facet name="footer">
>           <rich:dataScroller />
>         </f:facet>
>  
>   </rich:dataTable>
>     <h:outputText value="#{test.selectedItem}" />
> </h:form>
> {code} 
> This works just fine! However, *when i click to go to the next page on the dataScroller* and i click at a specific row , it gets the elements from the first page
> For example:
>  
> Page 1 - Names1,Names2,Names3, Names4
> Page 2 - Names4,Names5,Names6, Names8
>  
> First step:
>     - Click at the " Names 2"
>    - The String "Names 2" is displayed
>  
> Second step:
>     - Navigate to page 2
>  
> Third Step
>     - Click at the "Names 4"
>     - The String "Names 1" is displayed
>  

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