4 Replies Latest reply on Feb 2, 2011 6:01 AM by Ganga k

    extendedDataTable state save only columns, not sort and filter

    Ling Ip Newbie

      I am trying to save the columns, sort and filter for an extendedDataTable using tableState. I got the columns saved but not the sort and filter. The table state is saved into a seession variable. I ran out of idea. Any suggestion.

       

       

      <rich:extendedDataTable
                      id="projectList" var="project" value="#{projectList.resultList}"
                      reRender="ds" width="1800px" rows="20" height="550px"
                      tableState="#{projectList.state}"
                      rendered="#{not empty projectList.resultList}">
                      <rich:column sortBy="#{project.id}" filterBy="#{project.id}"
                          filterEvent="onblur" width="50px" label="Id">
                          <f:facet name="header">Id</f:facet>
                          #{project.id}
                      </rich:column>
                      <rich:column sortBy="#{project.name}" filterBy="#{project.name}"
                          filterEvent="onblur" width="200px" label="Name">
                          <f:facet name="header">Name</f:facet>
                          <s:link id="project" value="#{project.name}" propagation="none"
                              view="/project.xhtml" title="#{project.name}">
                              <f:param name="projectId" value="#{project.id}" />
                          </s:link>
                      </rich:column>
                      <rich:column sortBy="#{project.requester}" label="Requester"
                          filterBy="#{project.requester}" filterEvent="onblur" width="100px">
                          <f:facet name="header">Requester</f:facet>
                          <h:outputText value="#{project.requester}"
                              title="#{project.requester}" />
                      </rich:column>
                      <rich:column sortBy="#{project.priority}" width="50px"
                          filterBy="#{project.priority}" filterEvent="onblur"
                          label="Priority">
                          <f:facet name="header">Priority</f:facet>
                          <h:outputText value="#{project.priority}"
                              title="1=High, 3=Medium, 5=Low" />
                      </rich:column>

                   <f:facet name="footer">
                          <rich:datascroller id="ds" renderIfSinglePage="false" />
                      </f:facet>
                  </rich:extendedDataTable>

        • 1. Re: extendedDataTable state save only columns, not sort and filter
          Ilya Shaikovsky Master

          use sortOrder and filterValue column attributes in order to store the sorting and filtering also. If the sorting is multiple - you should manage sortPriority on the table also.

          • 2. Re: extendedDataTable state save only columns, not sort and filter
            Ling Ip Newbie

            Thanks for your help. The filterValue is working now. I need to have a distinct variable for each column.

            However, I am not so lucky in SortOrder. I got an error of argument type mismatch. I use String as type. I notice the deom i "ASCENDING". Is this a String Constant type? How do I change my backing bean to make it work?

             

            public void setSort(String sort) {
                    this.sort = sort;
                }

             

                public String getSort() {
                    return sort;
                }

             

            10:35:57,357 WARNING [lifecycle] javax.el.ELException: /projectList.xhtml @43,23 sortOrder="#{projectList.sort}": java.lang.IllegalArgumentException: argument type mismatch
            javax.faces.FacesException: javax.el.ELException: /projectList.xhtml @43,23 sortOrder="#{projectList.sort}": java.lang.IllegalArgumentException: argument type mismatch
                at org.richfaces.component.UIColumn.setSortOrder(UIColumn.java:147)
                at org.richfaces.component.UIColumn.toggleSortOrder(UIColumn.java:121)
                at org.richfaces.renderkit.AbstractExtendedTableRenderer.doDecode(AbstractExtendedTableRenderer.java:1168)
                at org.ajax4jsf.renderkit.RendererBase.decode(RendererBase.java:75)
                at javax.faces.component.UIComponentBase.decode(UIComponentBase.java:789)
                at org.ajax4jsf.component.UIDataAdaptor.processDecodes(UIDataAdaptor.java:1141)
                at org.ajax4jsf.component.UIDataAdaptor.processDecodes(UIDataAdaptor.java:1150)
                at javax.faces.component.UIForm.processDecodes(UIForm.java:209)
                at org.ajax4jsf.component.AjaxViewRoot$1.invokeContextCallback(AjaxViewRoot.java:392)
                at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:238)
                at org.ajax4jsf.component.AjaxViewRoot.processDecodes(AjaxViewRoot.java:409)
                at com.sun.faces.lifecycle.ApplyRequestValuesPhase.execute(ApplyRequestValuesPhase.java:78)
                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
                at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:178)
                at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
                at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:368)
                at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:495)
                at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
                at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
                at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
                at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
                at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
                at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
                at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
                at java.lang.Thread.run(Unknown Source)
            Caused by: javax.el.ELException: /projectList.xhtml @43,23 sortOrder="#{projectList.sort}": java.lang.IllegalArgumentException: argument type mismatch
                at com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:101)
                at org.richfaces.component.UIColumn.setSortOrder(UIColumn.java:145)
                ... 57 more
            Caused by: java.lang.IllegalArgumentException: argument type mismatch
                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
                at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
                at java.lang.reflect.Method.invoke(Unknown Source)
                at javax.el.BeanELResolver.setValue(BeanELResolver.java:108)
                at javax.el.CompositeELResolver.setValue(CompositeELResolver.java:69)
                at com.sun.faces.el.FacesCompositeELResolver.setValue(FacesCompositeELResolver.java:100)
                at org.jboss.el.parser.AstPropertySuffix.setValue(AstPropertySuffix.java:73)
                at org.jboss.el.parser.AstValue.setValue(AstValue.java:84)
                at org.jboss.el.ValueExpressionImpl.setValue(ValueExpressionImpl.java:249)
                at com.sun.facelets.el.TagValueExpression.setValue(TagValueExpression.java:93)
                ... 58 more
            10:35:57,357 SEVERE [lifecycle] JSF1054: (Phase ID: APPLY_REQUEST_VALUES 2, View ID: /projectList.xhtml) Exception thrown during phase execution: javax.faces.event.PhaseEvent[source=com.sun.faces.lifecycle.LifecycleImpl@6923cd]

            • 4. extendedDataTable state save only columns, not sort and filter
              Ganga k Newbie

              Hi ,

               

                       I am new to richfaces, working in the saving the "column width", I would like to know how to achieve it ?

              tableState="#{projectList.state}"

               

              what type is "state" property in " projectList " Bean ? and how bind to property and use it later ?

               

              Thanks in advance.