11 Replies Latest reply on Feb 14, 2010 3:13 AM by eugenbesel

    <rich:columns id="#{index}" problem

    eugenbesel

      Hello all.

       

      I try to create a dynamic table with extendedDataTable and tag <rich:columns

      it works, but if I want to sort the data it doesnt.

       

      I've read in other topics that I can create <rich:columns tag with dynamic id like id="#{index}"

      here is my code:

      <rich:extendedDataTable value="#{searchModul.columnData}" var="data" width="500px" height="100px" sortMode="single" selectionMode="multi" >
                   <f:facet name="header">
                       <h:outputText value="#{searchModul.tableHeader}"></h:outputText>
                   </f:facet>
                  <rich:columns id="#{data[ind]}" value="#{searchModul.columns}" var="col" index="ind" sortBy="#{data[ind]}">
                   <f:facet name="header"> 
                       <h:outputText value="#{col}"/> 
                   </f:facet> 
                   <h:outputText value="#{data[ind]}"></h:outputText>
                  </rich:columns>
             
                  </rich:extendedDataTable>

       

      After deploy I get the following error on runtime.

       

      org.apache.jasper.JasperException: /test-create.jsp(1066,1) According to TLD or attribute directive in tag file, attribute id does not accept any expressions
          at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
          at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
          at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
          at org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1120)
          at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:820)
          at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
          at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2359)
          at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2409)
          at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:839)
          at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)

       

       

      thank you for your help.

       

      wbr

        • 1. Re: <rich:columns id="#{index}" problem
          eugenbesel

          so, now I use facelets and made xhtml files from my jsp.

          now I can use id="#{index}", but this point hasn't resolved my issue.

          I still can not sort the table and if I try to filter the data I ge the following message:

           

          java.lang.NoClassDefFoundError: org/apache/commons/collections/iterators/IteratorChain
               org.richfaces.component.UIExtendedDataTable.fixedChildren(UIExtendedDataTable.java:397)
               org.ajax4jsf.component.UIDataAdaptor.iterate(UIDataAdaptor.java:1019)
               org.ajax4jsf.component.UIDataAdaptor.processDecodes(UIDataAdaptor.java:1140)
               org.ajax4jsf.component.UIDataAdaptor.processDecodes(UIDataAdaptor.java:1150)
               org.ajax4jsf.component.AjaxViewRoot$1.invokeContextCallback(AjaxViewRoot.java:395)
               org.ajax4

          does anybody know how can I resolve my problem???

          thank you
          • 2. Re: <rich:columns id="#{index}" problem
            eugenbesel

            so I found I get the message about IteratorChain.

             

            I downloaded the needed jar file.

             

            I changed my table from columns to column. the filtering of the table work now. But if make columns again it doesnt work. I tip a letter into filter field, the table is rerenderd but nothing happend.

             

            the problem with sorting still occurs. If I cklick on the column to sort it, the data disappears and I can only see the waitsymbol.

             

            my last version of xhtml file is like:

             

            <rich:extendedDataTable value="#{searchModul.columnData}" var="data" width="500px" height="600px" sortMode="single" selectionMode="multi">
                         <f:facet name="header">
                             <h:outputText value="#{searchModul.tableHeader}"></h:outputText>
                         </f:facet>
                             <rich:columns id="col_#{col}" value="#{searchModul.columns}" var="col" index="ind" filterBy="#{data[ind]}" sortBy="#{data[ind]}" sortOrder="#{searchModul.sortOrder}" filterEvent="onkeyup">
                         <f:facet name="header"> 
                             <h:outputText value="#{col}"/> 
                         </f:facet> 
                         <h:outputText value="#{data[ind]}"></h:outputText>
                        </rich:columns>
                        </rich:extendedDataTable>

            Java:

            public Map<String, Object> getSortOrder() {
                     for(ColumnConfigurationVO columnsIter : confVO.getColumns()){
                         sortOrder.put(columnsIter.getCaption(),Ordering.UNSORTED);
                        }
                    
                 return sortOrder;
                 }

             

            private List<ArrayList<String>> datamap = new ArrayList<ArrayList<String>>();

             

                /**
                 * this method create the data values for displaing n GUI
                 * @return
                 */
                public List<ArrayList<String>> getColumnData(){
                   
                    return datamap;
                }

             

            What have I done wrong?????????

             

            thank you

            • 3. Re: <rich:columns id="#{index}" problem
              ilya_shaikovsky

              please follow my suggestion at http://community.jboss.org/message/524732#524732

               

              Also in order to store current state of sorting/filtering with columns - you should map the sortOrder and filterValue to bean properties as it done at demo.

              • 4. Re: <rich:columns id="#{index}" problem
                eugenbesel

                hello Ilja,

                 

                thank you for your answer.

                 

                how should I write the setter methods for SortOrder:

                 

                my getter looks like:

                public Map<String, Object> getSortOrder() {    
                     return sortOrder;
                     }

                If I try with this setter-method and debug the application then it doesnt go in in this method.


                     public void setSortOrder(SortOrder sortOrder1){
                         System.out.print("");
                     }

                 

                or should it looks like this?

                     public void setSortOrder(Map<String, Object> map){
                          sortOrder = map;
                      }

                 

                the application doesnt go in this methods, thats why my sortOrder object has always the unsorted value.

                • 5. Re: <rich:columns id="#{index}" problem
                  ilya_shaikovsky
                  • 6. Re: <rich:columns id="#{index}" problem
                    eugenbesel

                    hello Ilja,

                     

                    thank you for the links.

                     

                    In demo example from Nick Belaevski he used BaseModifiableHibernateDataModel which he set in <rich:dataTable value="#{hibernateDataModel}"

                    is it necessary to use DataModel or I can also set a ArrayList to <rich:dataTable value="?"

                     

                    in my case, I took the DatatableStateHolder from Nick and bind it to my xhtml.

                    I debugged into the workflow and could see, that sortOrder object contains my chose, but the dataTable on xhtml isn't updated.

                    As I can see, I dont need to rerender the table with ajax. It should happen automaticly, isn't it??

                     

                    The filter function works now, but if I enter some letter into filter all of data disappear from the table.Should I implement the filter method by myself?

                     

                    here is my code.

                    <rich:dataTable value="#{searchModul.columnData}" var="data"
                                width="300px" height="300px" sortMode="single" selectionMode="multi">
                                 <f:facet name="header">
                                     <h:outputText value="#{searchModul.tableHeader}"></h:outputText>
                                 </f:facet>
                                     <rich:columns id="col_#{col}" value="#{searchModul.columns}"
                                     var="col" index="ind"
                                     filterBy="#{col}" filterEvent="onkeyup" sortBy="#{col}"
                                     sortOrder="#{dataTableStateHolder.sortOrders[col]}"
                                    filterValue="#{dataTableStateHolder.columnFilterValues[col]}">
                                    <f:facet name="header"> 
                                     <h:outputText value="#{col}"/> 
                                 </f:facet> 
                                 <h:outputText value="#{data[ind]}"></h:outputText>
                                </rich:columns>
                                </rich:dataTable>

                     

                    Java:

                    • 7. Re: <rich:columns id="#{index}" problem
                      eugenbesel

                      hello Ilja,

                      I found the solution of my issue.Now I can filter and sort of my data.

                       

                      do you know if it is possible to make a groupBy if I make a dynamic columns??

                       

                      thank you for your answer.

                      • 8. Re: <rich:columns id="#{index}" problem
                        ilya_shaikovsky
                        group by currently works according to sortBy definitions. So it should already works if sorting works.
                        • 9. Re: <rich:columns id="#{index}" problem
                          eugenbesel

                          tags "column" and "columns" don't contain groupBy attribute.

                          http://livedemo.exadel.com/richfaces-demo/richfaces/columns.jsf?tab=info&cid=4152767

                          just ExtendeDataTable contains attribute groupByColumn, which need an id of the column. In my case the columns are generated, So I dont have any id of the column.

                           

                          any ideas??

                           

                          thank you.

                          • 10. Re: <rich:columns id="#{index}" problem
                            eugenbesel

                            hello Ilja,

                             

                            you are right. If I use extendedDatatable, then can group my Data on UI. (not with <rich:dataTable ...

                             

                            If I group data by one column and sort this data by other column, then the groupByColumn is desappeard.

                             

                            is this a bug from Richfaces, or I've done something wrong???

                             

                            wbr

                            Eugen

                            • 11. Re: <rich:columns id="#{index}" problem
                              eugenbesel

                              I found my error. I set tableState attribute for my table.

                               

                              thank you for your help.