Thomas R. Corbin wrote:
> On Thursday 17 May 2007 5:00 am, Andrew Klochkov escreveu:
>
>> Andrew Klochkov wrote:
>>
>>> What's the best way to add css class to a DataTable column?
>>> The only way I see is to extend Panel and use it as a headers toolbar,
>>> but I'd like to have all the functionality the HeadersToolbar already
>>> has!
>>>
>> I can add class attr to the cells.
>>
>
> How do you do that?
>
>
By overriding DataTable.newCellItem. So if I use PropertyColumn
instances only I can use property expressions as css class names:
@Override
protected Item newCellItem(String id, int index, IModel model) {
PropertyColumn column = (PropertyColumn) model.getObject();
Item item = super.newCellItem(id, index, model);
item.add(new AttributeAppender("class", new
Model(column.getPropertyExpression()), " "));
return item;
}
--
Andrew Klochkov
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user