3 Replies Latest reply on Jun 17, 2013 6:23 PM by bleathem

    extendedDataTable custom sorting

    dageisz

      Hello,  i have some serious problems using the extendedDataTables sorting features when doin it with sortType="custom".

       

      These seem all related to the ExtendedDataTableRenderer's consumeTableState method. 

       

      I have a table whose content may change (add and remove Buttons). 

      On the initial render everything works fine and i can sort every column a thousend times with no inconsistencies.

      Then i add a new entry or remove one and the trouble starts: 

       

      The new order is set into the sortingBean and after a couple of gets (APPLY_REQUEST and INVOKE_APPLICATION phase) the consumeTableState Method is updating my sortingBeans state again, to the last rendered sorting direction (taken from the tableState).

      But this is on RENDER_RESPONSE phase wich should never change something on the model?! 

       

      After a lot of investigation time i found a workaround. It's ignoring all incomming set calls while in RENDER_RESPONSE phase (therefor i implement the Map interface and override the put behavior).

       

      I hope my description and the attached example (with the fix) helps to understand my problem.  After all it seems like a bug, but maybe i m doin something wrong.

        • 1. Re: extendedDataTable custom sorting
          bleathem

          Are you familiar with how to debug an server-side Java application?  If so, can you set a breakpoint in your sortingBean setter, can copy/paste the call stack into this thread?  I'd be curious to see where the update is originating.

          • 2. Re: extendedDataTable custom sorting
            dageisz

            Sure here are the stack traces:

             

            Typical put-call after hitting the sort button:

            Daemon Thread [[ACTIVE] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'] (Suspended (breakpoint at line 47 in TableSortBean))     
                 TableSortBean.put(String, SortOrder) line: 47     
                 TableSortBean.sortBy(String, boolean) line: 66     
                 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]     
                 NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39     
                 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25     
                 Method.invoke(Object, Object...) line: 597     
                 BeanELResolver.invokeMethod(Method, Object, Object[]) line: 737     
                 BeanELResolver.invoke(ELContext, Object, Object, Class[], Object[]) line: 467     
                 DemuxCompositeELResolver(CompositeELResolver).invoke(ELContext, Object, Object, Class[], Object[]) line: 246     
                 AstValue.invoke(EvaluationContext, Class[], Object[]) line: 228     
                 MethodExpressionImpl.invoke(ELContext, Object[]) line: 297     
                 TagMethodExpression.invoke(ELContext, Object[]) line: 105     
                 MethodBindingMethodExpressionAdapter.invoke(FacesContext, Object[]) line: 87     
                 ActionListenerImpl.processAction(ActionEvent) line: 101     
                 ResetInputAjaxActionListener.processAction(ActionEvent) line: 176     
                 UICommandLink(UICommand).broadcast(FacesEvent) line: 315     
                 RowKeyContextEventWrapper.broadcast(FacesContext) line: 104     
                 UIExtendedDataTable(UIDataAdaptor).broadcast(FacesEvent) line: 448     
                 UIViewRoot.broadcastEvents(FacesContext, PhaseId) line: 786     
                 UIViewRoot.processApplication(FacesContext) line: 1251     
                 InvokeApplicationPhase.execute(FacesContext) line: 81     
                 InvokeApplicationPhase(Phase).doPhase(FacesContext, Lifecycle, ListIterator) line: 101     
                 LifecycleImpl.execute(FacesContext) line: 118     
                 FacesServlet.service(ServletRequest, ServletResponse) line: 593     
                 StubSecurityHelper$ServletServiceAction.run() line: 227     
                 StubSecurityHelper.invokeServlet(ServletRequest, HttpServletRequest, ServletRequestImpl, ServletResponse, HttpServletResponse, Servlet) line: 125     
                 ServletStubImpl.execute(ServletRequest, ServletResponse, FilterChainImpl) line: 300     
                 TailFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 26     
                 FilterChainImpl.doFilter(ServletRequest, ServletResponse) line: 56     
                 MDCUserServletFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 57     
                 FilterChainImpl.doFilter(ServletRequest, ServletResponse) line: 56     
                 RequestEventsFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 27     
                 FilterChainImpl.doFilter(ServletRequest, ServletResponse) line: 56     
                 WebAppServletContext$ServletInvocationAction.wrapRun(ServletStubImpl, HttpServletRequest, HttpServletResponse) line: 3715     
                 WebAppServletContext$ServletInvocationAction.run() line: 3681     
                 AuthenticatedSubject.doAs(AbstractSubject, PrivilegedAction) line: 321     
                 SecurityManager.runAs(AuthenticatedSubject, AuthenticatedSubject, PrivilegedAction) line: 120     
                 WebAppServletContext.securedExecute(HttpServletRequest, HttpServletResponse, boolean) line: 2277     
                 WebAppServletContext.execute(ServletRequestImpl, ServletResponseImpl) line: 2183     
                 ServletRequestImpl.run() line: 1454     
                 ExecuteThread.execute(Runnable) line: 209     
                 ExecuteThread.run() line: 178     

            after adding a row and the sort direction has been set i get this non typical set call in RENDER_RESPONSE phase.

            Daemon Thread [[ACTIVE] ExecuteThread: '21' for queue: 'weblogic.kernel.Default (self-tuning)'] (Suspended (breakpoint at line 45 in TableSortBean))     
                 TableSortBean.put(String, SortOrder) line: 45     
                 TableSortBean.put(Object, Object) line: 1     
                 MapELResolver.setValue(ELContext, Object, Object, Object) line: 262     
                 DemuxCompositeELResolver._setValue(int, ELResolver[], ELContext, Object, Object, Object) line: 255     
                 DemuxCompositeELResolver.setValue(ELContext, Object, Object, Object) line: 281     
                 AstValue.setValue(EvaluationContext, Object) line: 197     
                 ValueExpressionImpl.setValue(ELContext, Object) line: 286     
                 TagValueExpression.setValue(ELContext, Object) line: 131     
                 ExtendedDataTableRenderer(SortingFilteringRowsRenderer).updateAttribute(FacesContext, UIComponent, String, Object) line: 169     
                 ExtendedDataTableRenderer.consumeTableState(FacesContext, UIDataTableBase, ExtendedDataTableState) line: 1023     
                 ExtendedDataTableRenderer.doEncodeBegin(ResponseWriter, FacesContext, UIComponent) line: 722     
                 ExtendedDataTableRenderer(RendererBase).encodeBegin(FacesContext, UIComponent) line: 115     
                 UIExtendedDataTable(UIComponentBase).encodeBegin(FacesContext) line: 826     
                 UIExtendedDataTable(UIComponent).encodeAll(FacesContext) line: 1777     
                 ExtendedPartialViewContextImpl$RenderVisitCallback.visit(VisitContext, UIComponent) line: 557     
                 RenderExtendedVisitContext(BaseExtendedVisitContext).invokeVisitCallback(UIComponent, VisitCallback) line: 321     
                 UIExtendedDataTable(UIDataAdaptor).visitTree(VisitContext, VisitCallback) line: 1322     
                 HtmlForm(UIComponent).visitTree(VisitContext, VisitCallback) line: 1623     
                 HtmlForm(UIForm).visitTree(VisitContext, VisitCallback) line: 371     
                 UIOutput(UIComponent).visitTree(VisitContext, VisitCallback) line: 1623     
                 UIViewRoot(UIComponent).visitTree(VisitContext, VisitCallback) line: 1623     
                 ExtendedPartialViewContextImpl.processPartialRenderPhase() line: 310     
                 ExtendedPartialViewContextImpl.processPartial(PhaseId) line: 213     
                 UIViewRoot.encodeChildren(FacesContext) line: 973     
                 UIViewRoot(UIComponent).encodeAll(FacesContext) line: 1779     
                 FaceletViewHandlingStrategy.renderView(FacesContext, UIViewRoot) line: 413     
                 MultiViewHandler.renderView(FacesContext, UIViewRoot) line: 124     
                 RestorableViewHandler(ViewHandlerWrapper).renderView(FacesContext, UIViewRoot) line: 286     
                 GlobalResourcesViewHandler(ViewHandlerWrapper).renderView(FacesContext, UIViewRoot) line: 286     
                 RenderResponsePhase.execute(FacesContext) line: 120     
                 RenderResponsePhase(Phase).doPhase(FacesContext, Lifecycle, ListIterator) line: 101     
                 LifecycleImpl.render(FacesContext) line: 139     
                 FacesServlet.service(ServletRequest, ServletResponse) line: 594     
                 StubSecurityHelper$ServletServiceAction.run() line: 227     
                 StubSecurityHelper.invokeServlet(ServletRequest, HttpServletRequest, ServletRequestImpl, ServletResponse, HttpServletResponse, Servlet) line: 125     
                 ServletStubImpl.execute(ServletRequest, ServletResponse, FilterChainImpl) line: 300     
                 TailFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 26     
                 FilterChainImpl.doFilter(ServletRequest, ServletResponse) line: 56     
                 MDCUserServletFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 57     
                 FilterChainImpl.doFilter(ServletRequest, ServletResponse) line: 56     
                 RequestEventsFilter.doFilter(ServletRequest, ServletResponse, FilterChain) line: 27     
                 FilterChainImpl.doFilter(ServletRequest, ServletResponse) line: 56     
                 WebAppServletContext$ServletInvocationAction.wrapRun(ServletStubImpl, HttpServletRequest, HttpServletResponse) line: 3715     
                 WebAppServletContext$ServletInvocationAction.run() line: 3681     
                 AuthenticatedSubject.doAs(AbstractSubject, PrivilegedAction) line: 321     
                 SecurityManager.runAs(AuthenticatedSubject, AuthenticatedSubject, PrivilegedAction) line: 120     
                 WebAppServletContext.securedExecute(HttpServletRequest, HttpServletResponse, boolean) line: 2277     
                 WebAppServletContext.execute(ServletRequestImpl, ServletResponseImpl) line: 2183     
                 ServletRequestImpl.run() line: 1454     
                 ExecuteThread.execute(Runnable) line: 209     
                 ExecuteThread.run() line: 178     
            

            Like i said in the first post the ExtendedDataTableRenderer.consumeTableState is calling the setter, when updating the column with the table state.

             

            Edit: and i forgot to mention that the same effect occurs with custom filters.

             

            Edit2: finaly found the issue the filter problem https://issues.jboss.org/browse/RF-12943

            • 3. Re: extendedDataTable custom sorting
              bleathem

              This will be addressed in RichFaces 4.3.3 with https://issues.jboss.org/browse/RF-12943