You were close, this is what I did to support ACC in simple tables:

@Override
protected Item<IColumn<T>> newCellItem(final String id, final int index,
final IModel<IColumn<T>> model) {
    Item<IColumn<T>> item = super.newCellItem(id, index, model);
    item.add(new AttributeModifier("class", new
Model<String>(getCellStyleClass())));
    item.add(new AttributeModifier("headers", getAccHeaderId(index)));
    return item;
}

I guess you could pass the Item<IColumn<T>> to your own getCellStyleClass()
method and grab the model from that Item to decide what CSS to apply.
~ Thank you,
    Paul Bors

On Tue, Jan 29, 2013 at 4:49 AM, brazz <alexander.li...@man.eu> wrote:

> Hi,
>
> I have a datatable, want to check a "td" element tag for a certain class
> attribute and add a class attribute in certain constellations (highlight
> cell items). Last option is to copy code from datatable and modify it, but
> not very nice.
>
> Ho can i access the cell items of the table?
>
> My datatable looks like this:
>
>
>
>
> i tried overriting newCellItem. But newCellItem never gets called. And in
> newRowItem i'm not able to access child elements (i'm able to add an
> AttributeModifier to the rowItem, but that's not enough, i need it for cell
> items).
>
>         @Override
>         protected Item<T> newRowItem(String id, int index, IModel<T> model)
>         {
>                 OddEvenItem<T> eventItem = new OddEvenItem<T>(id, index,
> model);
>                 eventItem.add(createOnclickBehavior(model, eventItem));
>                 return eventItem;
>         }
>
>         @Override
>         protected Item<T> newCellItem(String id, int index, IModel<T>
> model) {
>                 // TODO Auto-generated method stub
>                 return super.newCellItem(id, index, model);
>         }
>
> Many thanks for any suggestions!
>
>
>
> --
> View this message in context:
> http://apache-wicket.1842946.n4.nabble.com/Access-read-and-modify-td-Tag-cell-tag-in-Datatable-tp4655872.html
> Sent from the Users forum mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> For additional commands, e-mail: users-h...@wicket.apache.org
>
>

Reply via email to