7 Replies Latest reply on May 18, 2010 5:04 AM by peter.bachl

    rich:datatable - filtering with rich:columngroup

    dejela

      Hi!

       

      I need my table to have the followings:

       

      1. sorting

      2. filtering

      3. pagers

      4. dyanmic rowclasses.

       

      I wrote the following:

      <rich:dataTable id="iii" value="#{myBean.lspots}"
      var="spot" width="300px" rows="15">

      <f:facet name="header">
      <h:outputText value="Sorting Example" />
      </f:facet>
      <rich:columnGroup rowClasses="#{spot.statusName}">
      <rich:column filterBy="#{spot.duration}" filterEvent="onKeyUp">
      <f:facet name="header">
      <h:outputText value="Duration" />
      </f:facet>
      <h:outputText value="#{spot.duration}" />
      </rich:column>
      <rich:column filterBy="#{spot.statusName}" filterEvent="onKeyUp">
      <f:facet name="header">
      <h:outputText value="statusName" />
      </f:facet>
      <h:outputText value="#{spot.statusName}" />
      </rich:column>
      </rich:columnGroup>
      <f:facet name="footer">
      <rich:datascroller id="spots_scroll1" renderIfSinglePage="false"></rich:datascroller>
      </f:facet>

       

      </rich:dataTable>

       

      now - the rowclasses works but not he filtering.

      if i remove <rich:columnGroup rowClasses="#{spot.statusName}"> - and put the rowClasses in datatable tag - the filtering work but not the colors. it seems that rowClasses works only with columngroup but filtering doesn't work with it

      how can integrate both?

        • 1. Re: rich:datatable - filtering with rich:columngroup
          harut
          Hi, put rowClasses into your dataTable and change it's value to the Constant one. In your case rowClasses="spot.statusName" has dynamic value, because "spot" is an item of the #{myBean.lspots} Collection, and it is changed after each row generation...
          • 2. Re: rich:datatable - filtering with rich:columngroup
            dejela

            well that's the thing.. i need the row color to be displays dynamically according to the status,

            how can i do it with filtering and sorting?

            • 3. Re: rich:datatable - filtering with rich:columngroup
              harut

              you should have a String property (e.g. rowStyleClasses) in the Bean class (e.g. in myBean), and you should write a business logic functionality for that String to contain comma seperated css class names according to the current Collection for dataTable (myBean.lspots). Andt you should set rowClasses="#{myBean.rowStyleClasses}" for your dataTable, where rowStyleClasses is mentioned String property of your Bean class...

              • 4. Re: rich:datatable - filtering with rich:columngroup
                dejela
                great idea!!!
                • 5. Re: rich:datatable - filtering with rich:columngroup

                  Hi,

                   

                  did you get filtering in <rich:columnGroup> working?

                  I am trying to get this running without any success...

                   

                  So, any comments on your filtering-solution would be great!

                   

                  Thank you!

                  Peter

                  • 6. Re: rich:datatable - filtering with rich:columngroup
                    dejela

                    Hi!

                     

                    I didn't use columngroup at the end.

                     

                    Since, the pagers don't work well with grouping and filtering.

                     

                    At the end i used scrollbar.

                     

                    I implmented it like this:

                     

                     

                    <rich:extendedDataTable  sortPriority="#{spot.startTimeForTable}"
                    value="#{scheduleResultBean.lspotsOnDate}" var="spot" id="spots"
                    rowClasses="#{spot.statusName}" columnClasses="schCol"
                    rendered="#{scheduleResultBean.dateChooseHasSpots}" width="1000px"
                    height="415px" >
                    <rich:column id="startTime" label="Start Time"
                    sortBy="#{spot.startTime}" filterBy="#{spot.startTimeForTable}"
                    filterEvent="onkeyup" styleClass="schColR" style="text-align:center">
                    <f:facet name="header">
                    <h:outputText value="#{scheduleResultBean.colTime}" />
                    </f:facet>
                    <h:outputText value="#{spot.startTimeForTable}">
                    </h:outputText>
                    </rich:column>
                    </rich:extendedDataTable>

                     

                    where lspotsOnDate is a list of spots.

                     

                    spot object has field called statusName which also represents the CSS class name (Failed, Placed)

                     

                    public Collection<UsSpotsScheduleResult> getLspotsOnDate() {

                              return lspotsOnDate;

                         }

                     

                    ..

                     

                    UsSpotsScheduleResult

                    public String getStatusName() {

                              return statusName;

                         }

                    ..
                    CSS:
                    .Failed {
                         background-color: #C3C3C7;
                    }
                    .Placed {
                         background-color: #2D82E3;
                    }

                     

                    good luck!

                    • 7. Re: rich:datatable - filtering with rich:columngroup

                      thanks for your quick answer!

                      since I really want to use columnGroup I have created a new thread with a short example

                      http://community.jboss.org/thread/152099?tstart=0

                       

                      bye,

                      Peter