1 Reply Latest reply on Sep 9, 2008 10:18 AM by Konstantin Mishin

    scrollabledatatable rerender causing entire page to fail to

    Stefan Mohr Newbie

      This is occurring in 3.2.2 CR2 and 3.2.2 CR4.
      I've confirmed this behaviour is NOT occurring in 3.2.1.

      Sample JSP:

      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://richfaces.org/rich"prefix="rich" %>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j" %>
      
      <html>
       <head>
       <title>JSP Page</title>
       </head>
       <body>
       <f:view>
       <a4j:form>
       <rich:panel id="pnlMain">
       <f:facet name="header"><h:outputText value="Panel Name" /></f:facet>
       <a4j:region id="rgn1" rendered="#{TestBean.drawView1}">
       <rich:scrollableDataTable id="sdtItems" value="#{TestBean.items}" var="item" binding="#{TestBean.itemTable}">
       <rich:column>
       <f:facet name="header"><h:outputText styleClass="headerText" value="Name" /></f:facet>
       <h:outputText value="#{item.name}" />
       </rich:column>
       <rich:column>
       <f:facet name="header"><h:outputText styleClass="headerText" value="Description" /></f:facet>
       <h:outputText value="#{item.desc}" />
       </rich:column>
       </rich:scrollableDataTable>
       <br>
       <a4j:commandButton action="#{TestBean.goView2}" value="Go" reRender="pnlMain" />
       </a4j:region>
      
       <a4j:region id="rgn2" rendered="#{TestBean.drawView2}">
       HELLO TEST
       <a4j:commandButton action="#{TestBean.goView1}" value="Back to table" reRender="pnlMain" />
       </a4j:region>
       </rich:panel>
       </a4j:form>
       </f:view>
       </body>
      </html>
      


      Sample backing bean:
      package test;
      
      import java.util.ArrayList;
      import java.util.Collection;
      import java.util.Iterator;
      import javax.faces.event.ActionEvent;
      import org.richfaces.component.UIScrollableDataTable;
      import org.richfaces.model.selection.SimpleSelection;
      
      public class TestBean
      {
       private Collection<Item> items;
       private UIScrollableDataTable itemTable;
       private SimpleSelection selectedItemTableRow;
       private Item selectedItem;
       private int currentView = 1;
      
       public TestBean()
       {
       items = new ArrayList();
       items.add(new Item("name1", "description 1"));
       items.add(new Item("name2", "description 2"));
       }
      
       public Collection<Item> getItems()
       {
       return items;
       }
      
       public void setItems(Collection<Item> items)
       {
       this.items = items;
       }
      
       public UIScrollableDataTable getItemTable()
       {
       return itemTable;
       }
      
       public void setItemTable(UIScrollableDataTable itemTable)
       {
       this.itemTable = itemTable;
       }
      
       public SimpleSelection getSelectedItemTableRow()
       {
       return selectedItemTableRow;
       }
      
       public void setSelectedItemTableRow(SimpleSelection selecteditemTableRow)
       {
       this.selectedItemTableRow = selecteditemTableRow;
       }
      
       public void setSelectedItemRow(ActionEvent e)
       {
       Iterator<Object> iterator = getSelectedItemTableRow().getKeys();
       while (iterator.hasNext())
       {
       Object key = iterator.next();
       itemTable.setRowKey(key);
       if (itemTable.isRowAvailable())
       {
       selectedItem = (Item) itemTable.getRowData();
       break;
       }
       }
       }
      
       public boolean getDrawView1()
       {
       return currentView == 1;
       }
      
       public boolean getDrawView2()
       {
       return currentView == 2;
       }
      
       public String goView1()
       {
       currentView = 1;
       return null;
       }
      
       public String goView2()
       {
       currentView = 2;
       return null;
       }
      }
      


      The Item class is a simple POJO with 2 members and getters/setters.

      What occurs in 3.2.1 is that you can switch to the second view, and when you switch back the header is lost and the rows are no longer selectable.
      In 3.2.2 you cannot even switch to the new view - the returned page has a completely empty body, even if the form and region were nested inside other parent components.

      I've seen this in IE8, Firefox 3, and Chrome.
      The app server is Sun Java Application Server 9.1_01 running on Windows.