You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by lucast <lu...@hotmail.com> on 2011/12/12 10:12:08 UTC

adding css class to AbstractColumn table header

Dear Forum,
I'm using a DefaultDataTable (structure almost identical to  clickable cell
example from chapter 5, Apache Wicket Cookbook).

I want one particular column to have a different css class to the rest.
For that reason, when extending AbstractColumn<T>, I add the css class to
populateItem method:

public void populateItem(Item<ICellPopulator&lt;T>> cellItem, String
componentId, IModel<T> rowModel) {
	cellItem.add(new SimpleAttributeModifier("class", "nameOfCssClass"));
...
}


That works fine for each cell but the class is not added to the column
header.
Is there a way to add a class to the column header for AbstractColumn?

Thanks in advance,
Lucas

--
View this message in context: http://apache-wicket.1842946.n4.nabble.com/adding-css-class-to-AbstractColumn-table-header-tp4185280p4185280.html
Sent from the Users forum mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: adding css class to AbstractColumn table header

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

You need to override
org.apache.wicket.extensions.markup.html.repeater.data.table.AbstractColumn.getHeader(String)
and return the component returned by super.getHeader(id) + your
attributemodifier.

On Mon, Dec 12, 2011 at 10:12 AM, lucast <lu...@hotmail.com> wrote:
> Dear Forum,
> I'm using a DefaultDataTable (structure almost identical to  clickable cell
> example from chapter 5, Apache Wicket Cookbook).
>
> I want one particular column to have a different css class to the rest.
> For that reason, when extending AbstractColumn<T>, I add the css class to
> populateItem method:
>
> public void populateItem(Item<ICellPopulator<T>> cellItem, String
> componentId, IModel<T> rowModel) {
>        cellItem.add(new SimpleAttributeModifier("class", "nameOfCssClass"));
> ...
> }
>
>
> That works fine for each cell but the class is not added to the column
> header.
> Is there a way to add a class to the column header for AbstractColumn?
>
> Thanks in advance,
> Lucas
>
> --
> View this message in context: http://apache-wicket.1842946.n4.nabble.com/adding-css-class-to-AbstractColumn-table-header-tp4185280p4185280.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org