Nested rich:datascrller (bug?)
israel.bgf Sep 9, 2009 8:14 AMHello, i found what i think that's a bug with the datascroller component, I wanted to know if you richfaces guys could confirm it. I even did a simple test-case with Seam (2.2.0) with Richfaces (3.3.1 / 3.3.2 CR) on Jboss 4.2.3 (JSF 1.2_09).
The problem happens whe i use nested data-tables with data-scrollers. The problems are the following (follow the steps sequentially).
1 - After "opening" the first data-table the data-scroller dont works (visually at least).
2 - After "opening" another data-table the "new" data-scroller is in the last page selected (it should start in the page 1) (example: select the page 2 in the first step and now open a new one).
3 - If you try to open another datatables the data-scroller will always be at the index of the last datascroller changed, not in the page 1.
Is this a bug? Here goes the source code of the page and the backing-bean, you can test it easily in any Seam app.
---- testcase.xhtml
<?xml version="1.0" encoding="ISO-8859-1" ?> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:rich="http://richfaces.org/rich" xmlns:a4j="http://richfaces.org/a4j" xmlns:s="http://jboss.com/products/seam/taglib"> <body> <a4j:form> <rich:dataTable id="list" value="#{bean.list}" var="item" rows="10"> <rich:column align="center"> <f:facet name="header"> Value </f:facet> #{item} </rich:column> <rich:column breakBefore="true"> <a4j:commandButton value="Open" action="#{bean.setSublistRendered(true)}" reRender="sublistPanel" ajaxSingle="true"/> <a4j:commandButton value="Close" action="#{bean.setSublistRendered(false)}" reRender="sublistPanel" ajaxSingle="true"/> <a4j:outputPanel id="sublistPanel"> <a4j:outputPanel rendered="#{bean.sublistRendered}"> <rich:dataTable id="sublist" value="#{bean.sublist}" var="item" rows="10"> <rich:column align="center"> <f:facet name="header"> Value </f:facet> #{item} </rich:column> <f:facet name="footer"> <rich:datascroller ajaxSingle="true"/> </f:facet> </rich:dataTable> </a4j:outputPanel> </a4j:outputPanel> </rich:column> <f:facet name="footer"> <rich:datascroller ajaxSingle="true"/> </f:facet> </rich:dataTable> </a4j:form> </body> </html>
----
-- Bean.java
package br.com.techpeople.nexxcard.view; import java.util.ArrayList; import java.util.List; import org.jboss.seam.ScopeType; import org.jboss.seam.annotations.Create; import org.jboss.seam.annotations.Name; import org.jboss.seam.annotations.Scope; @Name("bean") @Scope(ScopeType.PAGE) public class Bean { private List<String> list; private List<String> sublist; private boolean sublistRendered = false; @Create public void init(){ list = new ArrayList<String>(); sublist = new ArrayList<String>(); for(int i = 0; i < 33; i++){ list.add("list " + i); sublist.add("sublist " + i); } } public List<String> getList() { return list; } public void setList(List<String> list) { this.list = list; } public List<String> getSublist() { return sublist; } public void setSublist(List<String> sublist) { this.sublist = sublist; } public boolean isSublistRendered() { return sublistRendered; } public void setSublistRendered(boolean sublistRendered) { this.sublistRendered = sublistRendered; } }
I found this issue trying to implement a expandable-datatable, and it worked well the problem happend when i tried to paginate the "sublist". This code is a very simplified version of the code that i'm using, but for example, some bad things would happen if the lists used were with different sizes (like the one that i tried to implement).
Any ideas? Should i post it on JIRA?