Hi,

it's a little bit finicky, but it can be done:

DataTable dataTable = new DefaultDataTable<Contact, String>("table", columns, new SortableContactDataProvider(), 8) { protected Item<IColumn<Contact, String>> newCellItem(final String id, final int index, final IModel<IColumn<Contact, String>> model)
            {
return new Item<IColumn<Contact, String>>(id, index, model) {
                        @Override
                        protected void onComponentTag(ComponentTag tag) {
                            super.onComponentTag(tag);

// parent is the repeater for the cells, its parent is the row Contact contact = (Contact) getParent().getParent().getDefaultModelObject();
                            if (contact.isSpecĂ­al()) {
                                tag.setName("th");
                            }
                        }
                    };
                }
        };

In a future version we might want to change #newCellItem() to get a reference to the row's model - that would remove the need to lookup the row object from the grandparent.

Have fun
Sven


On 18.06.2015 14:15, Steve Swinsburg wrote:
Hi all,

I have a datatable and need to make it more accessible for screenreaders.

I am using an AbstractColumn and setting the getHeader and populateItem
methods with the contents.

In a particular row I want to change the markup of the cells from TD to TH,
as they are header type content. Is this possible in Wicket, to change the
HTML tag? This is generated markup within the DataTable component so I'm
wondering if we can influence the HTML tag that is output.

The second issue is that when using getHeader to set the header cell
contents, it outputs this into a span within the TH, not directly within
the TH itself. I need to add the 'scope="col"' ARIA attribute to the TH but
cannot access it (even via getParent()). Again, generated markup.

Thanks for any assistance.

regards,
Steve



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

Reply via email to