Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2
    • Fix Version/s: None
    • Component/s: Components/Renderers
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      217
    • Status Whiteboard:
      Hide

      cat2 renderkitdoc size_small importance_small

      Show
      cat2 renderkitdoc size_small importance_small

      Description

      Add a styleClass attribute to h:column and relegate the columnClasses attribute
      from h:dataTable to a purpose similar to what rowClasses does: cycle through
      each item in the list repeatedly (the use case being the ability to apply
      alternating styles, like differently-colored even and odd columns, without
      requiring knowledge of the number of columns).

      There should be nothing in the <h:dataTable> attribute list that is dependant
      upon the actual number of columns appearing inside of the table. All
      information related to specific columns should be associated with each column's
      corresponding <h:column> entity. Indeed, this is already the case with the sole
      exception of the columnClasses attribute.

      This is related to: https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=426

        Issue Links

          Activity

          Hide
          dmlloyd added a comment -

          Incidentally, adding a styleClass attribute to the <h:column> tag can be done
          without breaking backwards compatibility. Changing the behavior of
          columnClasses will be somewhat more difficult. You may want to create a new
          attribute called columnCycleClasses or something - or maybe not, given that the
          1.2 JSF implementation implemented the columnClasses attribute incorrectly
          (until just now), and said implementation happens to concur with my proposed
          behavior.

          Show
          dmlloyd added a comment - Incidentally, adding a styleClass attribute to the <h:column> tag can be done without breaking backwards compatibility. Changing the behavior of columnClasses will be somewhat more difficult. You may want to create a new attribute called columnCycleClasses or something - or maybe not, given that the 1.2 JSF implementation implemented the columnClasses attribute incorrectly (until just now), and said implementation happens to concur with my proposed behavior.
          Hide
          dmlloyd added a comment -

          Created an attachment (id=110)
          Implement a styleClass property on <h:column>

          Show
          dmlloyd added a comment - Created an attachment (id=110) Implement a styleClass property on <h:column>
          Hide
          Ed Burns added a comment -

          I've asked the Mojarra team if they think this is ok to do.

          Show
          Ed Burns added a comment - I've asked the Mojarra team if they think this is ok to do.
          Hide
          Ed Burns added a comment -

          Move to unscheduled target milestone

          Show
          Ed Burns added a comment - Move to unscheduled target milestone
          Hide
          Ed Burns added a comment -

          Prepare to delete api subcomponent

          Show
          Ed Burns added a comment - Prepare to delete api subcomponent
          Hide
          mojavelinux added a comment -

          Update milestone and component.

          Show
          mojavelinux added a comment - Update milestone and component.
          Hide
          mojavelinux added a comment -

          In addition to the styleClass attribute, the style attribute should be added as
          well. Assigning a style to a column is something that simply cannot be done with
          the current <h:dataTable>/<h:column> component pair.

          Show
          mojavelinux added a comment - In addition to the styleClass attribute, the style attribute should be added as well. Assigning a style to a column is something that simply cannot be done with the current <h:dataTable>/<h:column> component pair.
          Hide
          Ed Burns added a comment -

          cat2

          Show
          Ed Burns added a comment - cat2
          Hide
          Ed Burns added a comment -

          renderkit

          Show
          Ed Burns added a comment - renderkit
          Hide
          Ed Burns added a comment -

          These are targeted at 2.1.

          Show
          Ed Burns added a comment - These are targeted at 2.1.
          Hide
          rogerk added a comment -

          triage

          Show
          rogerk added a comment - triage
          Hide
          Ed Burns added a comment -

          rogerk

          Show
          Ed Burns added a comment - rogerk
          Hide
          rogerk added a comment -

          triage

          Show
          rogerk added a comment - triage
          Hide
          rogerk added a comment -

          triage

          Show
          rogerk added a comment - triage
          Hide
          Mark Struberg added a comment -

          hi!

          just like to push this up since I already came across this issue a few times.
          Today a colleague of mine had this again: he looked at <h:column> where he found the footerClass and headerClass attributes, but no styleClass for h:column. The columnClasses attribute in <h:dataTable> is not a full replacement since you cannot do data based css assignment.

          This is e.g needed if you have a accounting balance and a cash column with debit and credit values, and like to show all credits in green and debits in red.
          Of course you can do this with <span> but it is not really intuitive why there is no styleClass on the <td> at all.

          Show
          Mark Struberg added a comment - hi! just like to push this up since I already came across this issue a few times. Today a colleague of mine had this again: he looked at <h:column> where he found the footerClass and headerClass attributes, but no styleClass for h:column. The columnClasses attribute in <h:dataTable> is not a full replacement since you cannot do data based css assignment. This is e.g needed if you have a accounting balance and a cash column with debit and credit values, and like to show all credits in green and debits in red. Of course you can do this with <span> but it is not really intuitive why there is no styleClass on the <td> at all.
          Hide
          i_oss added a comment -

          +1 (also for Dan's style-attribute)

          Additionally i'd like to propose that we also add a possibility to add a styleClass/style per row, that can depend on the current var-value, instead of having to calculate the classes for all rows upfront. (There is also no way to add a style-attribute per row). Unfortunately rowClasses is already taken. While rowStyleClass would be perfect I think it is to close to rowClasses.
          so:

          <h:dataTable var="item" value="..." 
                  rowStyle="#{item.important ? 'font-weight: bold' : ''}"
                  rowStyleClass='trilternate#{component.rowIndex%3}'>
          

          Not so important: Introduce varstatus as for ui:repeat / c:forEach, even if you can calculate index/last/first/etc. from #

          {component}

          , I think most template authors will not know that + it gets ugly.

          Eventually!!! document, that 'global'-column-styling should be done with <f:facet name="colgroups">, if possible (less to render).

          Show
          i_oss added a comment - +1 (also for Dan's style-attribute) Additionally i'd like to propose that we also add a possibility to add a styleClass/style per row, that can depend on the current var-value, instead of having to calculate the classes for all rows upfront. (There is also no way to add a style-attribute per row). Unfortunately rowClasses is already taken. While rowStyleClass would be perfect I think it is to close to rowClasses. so: <h:dataTable var = "item" value= "..." rowStyle= "#{item.important ? 'font-weight: bold' : ''}" rowStyleClass='trilternate#{component.rowIndex%3}'> Not so important: Introduce varstatus as for ui:repeat / c:forEach, even if you can calculate index/last/first/etc. from # {component} , I think most template authors will not know that + it gets ugly. Eventually!!! document, that 'global'-column-styling should be done with <f:facet name="colgroups">, if possible (less to render).
          Hide
          codylerum added a comment -

          +1

          Defining classes one per column in order on the datatable via columnClasses is far to brittle. RichFaces has provided this for years in their rich:column via styleClass http://docs.jboss.org/richfaces/4.3.X/4.3.0.Final/vdldoc/

          Show
          codylerum added a comment - +1 Defining classes one per column in order on the datatable via columnClasses is far to brittle. RichFaces has provided this for years in their rich:column via styleClass http://docs.jboss.org/richfaces/4.3.X/4.3.0.Final/vdldoc/
          Hide
          Ed Burns added a comment -

          Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.

          Show
          Ed Burns added a comment - Set priority to baseline ahead of JSF 2.3 triage. Priorities will be assigned accurately after this exercise.
          Hide
          Manfred Riem added a comment -

          Setting priority to Major, because of higher vote count

          Show
          Manfred Riem added a comment - Setting priority to Major, because of higher vote count
          Hide
          codylerum added a comment -

          With Richfaces sun-setting in June 2016 it would be very nice to pick this feature up in 2.3

          This is really the only feature that keeps me from using the native JSF datatable

          Show
          codylerum added a comment - With Richfaces sun-setting in June 2016 it would be very nice to pick this feature up in 2.3 This is really the only feature that keeps me from using the native JSF datatable
          Hide
          codylerum added a comment -

          I've gone ahead and implemented styleClass on column and rowClass on datatable.

          This aligns with now Richfaces named the properties.

          https://github.com/codylerum/mojarra/tree/JAVASERVERFACES_SPEC_PUBLIC-217

          I'm going to need some review and pointers to know if I've updated the docs correctly.

          Show
          codylerum added a comment - I've gone ahead and implemented styleClass on column and rowClass on datatable. This aligns with now Richfaces named the properties. https://github.com/codylerum/mojarra/tree/JAVASERVERFACES_SPEC_PUBLIC-217 I'm going to need some review and pointers to know if I've updated the docs correctly.

            People

            • Assignee:
              Unassigned
              Reporter:
              dmlloyd
            • Votes:
              10 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated: