7 Replies Latest reply on Dec 24, 2008 4:37 AM by Nicolas Feybesse

    ExtendedDatatable reRender : tableState property not called

    Nicolas Feybesse Newbie

      Issue : RF-5041 is marked RESOLVED :
      https://jira.jboss.org/jira/browse/RF-5041

      But I still have a problem with tableState property :
      When extendeddatatable is Rerendered in ajax requests, tableState property is not called, even datamodel has changed or columns number has changed.

      I can't use this feature due to this problem.
      Any solution ? Perhaps API could give a method to force State initialization ?

      Thanks in advance
      NF

        • 1. Re: ExtendedDatatable reRender : tableState property not cal
          Ilya Shaikovsky Master

          so reopen the issue. if you sure that you checked on the latest snapshot.

          • 2. Re: ExtendedDatatable reRender : tableState property not cal
            Nicolas Feybesse Newbie

            Yes, I am sure.
            SNAPSHOT and BETA4 have still the problem.

            You can see that with this code :


            <h:form id="form">
             <rich:extendedDataTable value="#{test.rows}" var="row" tableState="#{test.tableState}">
             <rich:columns value="#{test.columns}" var="column" index="ind">
             <f:facet name="header">
             <h:outputText value="#{column.name}" />
             </f:facet>
             <h:outputText value="#{row[ind]}" />
             </rich:columns>
             </rich:extendedDataTable>
             <a:commandButton value="Add column" action="#{test.addAColumn}" reRender="form" />
             <a:commandButton value="Remove column" action="#{test.removeAColumn}" reRender="form" />
             <a:commandButton value="Rerender only" reRender="form" />
             </h:form>


            and backBean :

            
            import java.util.ArrayList;
            import java.util.Arrays;
            import java.util.List;
            
            import javax.faces.model.DataModel;
            import javax.faces.model.ListDataModel;
            
            import org.jboss.seam.ScopeType;
            import org.jboss.seam.annotations.Create;
            import org.jboss.seam.annotations.Name;
            import org.jboss.seam.annotations.Scope;
            import org.jboss.seam.log.Log;
            import org.jboss.seam.log.Logging;
            import org.richfaces.event.DropEvent;
            
            @Name("test")
            @Scope(ScopeType.SESSION)
            public class Test {
             private static final Log log=Logging.getLog(Test.class);
            
             private String tableState;
            
             private List<Column> columns;
             private List<List<String>> rows;
            
             @Create
             public void init(){
             removeAColumn();
             }
            
            
             public List<Column> getColumns(){
             return columns;
             }
            
             public List<List<String>> getRows(){
             log.info("Call getRows !!!");
             return rows;
             }
            
             public void addAColumn(){
             columns=Arrays.asList(new Column[]{new Column("Col1"),new Column("Col2"),new Column("Col3")});
             rows=Arrays.asList(
             Arrays.asList( new String[]{"a","b","c"}),
             Arrays.asList( new String[]{"a","b","c"}),
             Arrays.asList( new String[]{"a","b","c"}),
             Arrays.asList(new String[]{"d","e","f"}));
             }
            
             public void removeAColumn(){
             columns=Arrays.asList(new Column[]{new Column("Col1"),new Column("Col2")});
             rows=Arrays.asList(
             Arrays.asList(new String[]{"a","b"}),
             Arrays.asList(new String[]{"a","b"}),
             Arrays.asList(new String[]{"a","b"}),
             Arrays.asList(new String[]{"d","e"}));
             }
            
             public String getTableState() {
             log.info("Get table state : "+tableState);
             return tableState;
             }
            
             public void setTableState(String tableState) {
             log.info("Set table state : "+tableState);
             this.tableState = tableState;
             }
            
            
            
             public class Column {
             private String name;
            
             public Column(String name){
             this.name=name;
             }
            
             public String getName(){
             return name;
             }
             }
            
            }


            • 3. Re: ExtendedDatatable reRender : tableState property not cal
              Nicolas Feybesse Newbie

              Sorry Ilya, I have not the permissions to reopen the issue.
              Could you do that for me ? Or give me the permission ?

              NF

              • 4. Re: ExtendedDatatable reRender : tableState property not cal
                Pawel Golawski Newbie

                tableState property is called only on table initial render,
                So this state is stored inside component between requests via saveState/restoreState mechanism.
                What is the purpose to call getter for tableState property on every request?
                Do you want to change "manually" the property value in backing bean?

                • 5. Re: ExtendedDatatable reRender : tableState property not cal
                  Pawel Golawski Newbie

                  The component was changed to call getting tableState property on every request.
                  Changes will be available in new snapshot version.

                  • 6. Re: ExtendedDatatable reRender : tableState property not cal
                    Nicolas Feybesse Newbie

                    Hi,

                    I have now another problem :

                    tableState property don't reflect changes made on columns width.

                    It seems that tableState property getter is called before table state property setter and erases the state changes we have possibly made.

                    I think tableState property getter must be called just before render phase, after the invoke application phase has ended (in the same time the datamodel getter is called).


                    NF

                    • 7. Re: ExtendedDatatable reRender : tableState property not cal
                      Nicolas Feybesse Newbie

                      Hi.

                      Pawel Golawsky has commtitted a patch.
                      All is ok now.

                      Thanks.