5 Replies Latest reply on Oct 2, 2007 12:19 PM by j-pro

    rich:scrollableDataTable style classes problem

    j-pro

      Good afternoon.

      I use scrollableDataTable and wanted to set up five different classes for it: one for header, one for columns and three for rows(active, selected and ordinary). As I've understood, all classes set by user are merged with RF default classes for this kind of table.

      Well, the code is:

      ...
      
       <h:form id="relativesTab_dataTableForm">
       <rich:scrollableDataTable height="200px" rowKeyVar="rkv" frozenColCount="1" activeClass="sdt_row_active"
       selectedClass="sdt_row_selected" rowClasses="sdt_row1,sdt_row2" columnClasses="sdt_col"
       width="470px" id="staffDataTable" rows="#{amBean.employeeListMan.listSize}"
       value="#{amBean.employeeListMan.employees}" var="employee" sortMode="single">
      
       <rich:column id="firstName">
       <f:facet name="header"><h:outputText styleClass="sdt_head" value="First Name" /></f:facet>
       <h:outputText value="#{employee.firstName}" />
       </rich:column>
      
       <rich:column id="lastName">
       <f:facet name="header"><h:outputText styleClass="sdt_head" value="Last Name" /></f:facet>
       <h:outputText value="#{employee.lastName}" />
       </rich:column>
      
       <rich:column id="sex">
       <f:facet name="header"><h:outputText styleClass="sdt_head" value="Sex" /></f:facet>
       <h:outputText value="#{employee.sex}" />
       </rich:column>
      
       <rich:column id="birthDate">
       <f:facet name="header"><h:outputText styleClass="sdt_head" value="Birth Date" /></f:facet>
       <h:outputText value="#{employee.birthDate}" />
       </rich:column>
      
       <rich:column id="birthPlace">
       <f:facet name="header"><h:outputText styleClass="sdt_head" value="Birth Place" /></f:facet>
       <h:outputText value="#{employee.birthPlace}" />
       </rich:column>
      
       </rich:scrollableDataTable>
       </h:form>
      
      ...


      and styles for that are:
      .sdt_col
      {
       font-family: Tahoma;
       font-size: 11px;
       color: #000000;
       text-decoration: none;
       font-weight: bold;
       text-align: center;
       vertical-align: middle;
       padding-left: 5px;
       padding-right: 5px;
      }
      
      .sdt_row_active
      {
       background-color: #FF0000;
       color: #4e6fbc;
      }
      
      .sdt_row_selected
      {
       background-color: #0000FF;
       color: #000000;
      }
      
      .sdt_row1
      {
       background-color: #FFFFFF;
      }
      
      .sdt_row2
      {
       background-color: #AAAAAA;
      }
      
      .sdt_head
      {
       padding : 4px 4px 4px 4px;
       border-right : 1px solid #c0c0c0;
       border-bottom : 1px solid #c0c0c0;
       font-family: Tahoma;
       font-size: 11px;
       font-weight: bold;
       color: #000000;
       text-align : center;
       text-decoration: none;
       text-align: center;
      }


      So if I use the code pasted above - the colors are constant - odd rows are with white background and even rows are with gray background. If I click on a row - colors are NOT changing. When I just remove rowClasses attribute - the selectedClass attribute works well, but activeClass still doesn't. And when I remove both of rowClasses and selectedClass, leaving only activeClass - it starts working normally.

      Why does it happens? Can't I use a combination of these three attributes? Or it's a bug?

        • 1. Re: rich:scrollableDataTable style classes problem
          j-pro

          Two more questions about these styles in scrollableDataTable:

          1. Why vertical-align: middle; doesn't work in sdt_col for columns? The text is always aligned on top of the cell. But simple text-align and paddings do work... It's a TD - so vertical-align should work there, isn't it?

          2. Why padding or margin attributes in sdt_head class doesn't work for header columns? I've tried to set this class to headerClass and captionClass attributes of scrollableDataTable - didn't help. How to make header text in headers be on X pixels lower than the top border, for example? padding-top and margin-top didn't help...


          Thanks in advance.

          • 2. Re: rich:scrollableDataTable style classes problem
            j-pro

            So is it my fault or maybe some bug in RF?

            • 3. Re: rich:scrollableDataTable style classes problem
              j-pro

              Please, tell me if anybody can help me with this, or if nobody can help... then I'll try to find out other ways to solve the task...

              Sorry for asking again, just want to know if anybody can help.

              Thanks for understanding.

              • 4. Re: rich:scrollableDataTable style classes problem
                maksimkaszynski

                .sdt_row_active and .sdt_row_selected - move these classes after .sdt_row1 and .sdt_row2.

                Problem arises because browsers treat classes defined later to be more important than ones defined before

                • 5. Re: rich:scrollableDataTable style classes problem
                  j-pro

                  That works, thanks, Maksim.

                  The thing which remains is: when specifying rowClasses for rich:scrollableDataTable, without specifying selectedClass and activeClass, nothing happens when selecting a row(its color isn't changing). When no rowClasses, selectedClass , activeClass is specified, everything is set by default(when selecting a row, its color changes).


                  Created: http://jira.jboss.com/jira/browse/RF-1057