Issue Details (XML | Word | Printable)

Key: JAVASERVERFACES_SPEC_PUBLIC-217
Type: Improvement Improvement
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: dmlloyd
Votes: 10
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
javaserverfaces-spec-public

Add a styleClass attribute to h:column

Created: 12/Oct/06 03:33 PM   Updated: 24/Jan/14 09:49 PM
Component/s: Components/Renderers
Affects Version/s: 1.2
Fix Version/s: 2.3

Time Tracking:
Not Specified

File Attachments: 1. Text File issue217.patch (5 kB) 26/Jan/07 10:14 AM - dmlloyd

Environment:

Operating System: All
Platform: All

Issue Links:
Dependency
 

Issuezilla Id: 217
Status Whiteboard:

cat2 renderkitdoc size_small importance_small

Tags:
Participants: codylerum, dmlloyd, Ed Burns, i_oss, Mark Struberg, mojavelinux and rogerk


 Description  « Hide

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



dmlloyd added a comment - 13/Oct/06 11:51 AM

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.


dmlloyd added a comment - 26/Jan/07 10:14 AM

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


Ed Burns added a comment - 15/Oct/08 11:43 AM

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


Ed Burns added a comment - 24/Sep/09 09:13 AM

Move to unscheduled target milestone


Ed Burns added a comment - 24/Nov/09 07:40 AM

Prepare to delete api subcomponent


mojavelinux added a comment - 01/Mar/10 02:13 PM

Update milestone and component.


mojavelinux added a comment - 01/Mar/10 02:56 PM

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.


Ed Burns added a comment - 03/Mar/10 02:23 PM

cat2


Ed Burns added a comment - 22/Mar/10 11:13 AM

renderkit


Ed Burns added a comment - 15/May/10 07:54 AM

These are targeted at 2.1.


rogerk added a comment - 17/Jun/10 08:23 AM

triage


Ed Burns added a comment - 22/Jun/10 09:04 PM

rogerk


rogerk added a comment - 27/Oct/10 10:55 AM

triage


rogerk added a comment - 16/Nov/10 11:36 AM

triage


Mark Struberg added a comment - 12/May/11 03:47 PM

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.


i_oss added a comment - 12/May/11 07:06 PM

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


codylerum added a comment - 03/Oct/13 10:33 PM

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