[JAVASERVERFACES_SPEC_PUBLIC-217] Add a styleClass attribute to h:column Created: 12/Oct/06  Updated: 01/Aug/14

Status: Open
Project: javaserverfaces-spec-public
Component/s: Components/Renderers
Affects Version/s: 1.2
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: dmlloyd Assignee: Unassigned
Resolution: Unresolved Votes: 10
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Attachments: Text File issue217.patch    
Issue Links:
Dependency
blocks JAVASERVERFACES_SPEC_PUBLIC-627 Inconsistent column styles handling w... Open
Issuezilla Id: 217
Status Whiteboard:

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



 Comments   
Comment by dmlloyd [ 13/Oct/06 ]

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.

Comment by dmlloyd [ 26/Jan/07 ]

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

Comment by Ed Burns [ 15/Oct/08 ]

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

Comment by Ed Burns [ 24/Sep/09 ]

Move to unscheduled target milestone

Comment by Ed Burns [ 24/Nov/09 ]

Prepare to delete api subcomponent

Comment by mojavelinux [ 01/Mar/10 ]

Update milestone and component.

Comment by mojavelinux [ 01/Mar/10 ]

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.

Comment by Ed Burns [ 03/Mar/10 ]

cat2

Comment by Ed Burns [ 22/Mar/10 ]

renderkit

Comment by Ed Burns [ 15/May/10 ]

These are targeted at 2.1.

Comment by rogerk [ 17/Jun/10 ]

triage

Comment by Ed Burns [ 22/Jun/10 ]

rogerk

Comment by rogerk [ 27/Oct/10 ]

triage

Comment by rogerk [ 16/Nov/10 ]

triage

Comment by Mark Struberg [ 12/May/11 ]

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.

Comment by i_oss [ 12/May/11 ]

+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).

Comment by codylerum [ 03/Oct/13 ]

+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/

Comment by Ed Burns [ 01/Aug/14 ]

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

Comment by Manfred Riem [ 01/Aug/14 ]

Setting priority to Major, because of higher vote count

Generated at Mon Apr 27 21:08:06 UTC 2015 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.