I added a class "check" to the first header <th> element by next code:

    ....
    issues = new DataTable("issues", columns.toArray(new
IColumn[columns.size()]), issueListProvider, itemsPerPage) {

            @Override protected Item newRowItem(String id, int index, IModel
model) {
                return new OddEvenItem(id, index, model);
            }
        };
    issues.addTopToolbar(new IssueHeadersToolbar(issues,
issueListProvider));
    ...

    public static class IssueHeadersToolbar extends HeadersToolbar {

        public IssueHeadersToolbar(DataTable table, ISortStateLocator
stateLocator) {
            super(table, stateLocator);

            RepeatingView headers = (RepeatingView) get("headers");
            MarkupContainer checkColumn = (MarkupContainer)
((MarkupContainer) headers.get("1")).get("header");
            checkColumn.add(new AttributeModifier("class", true, new
Model("check")));
        }
    }

Is it possible to simplify?


Stefan Lindner wrote:
> 
> I can manipulate the data grip part of a DataTable by overriding
> newCellItem. But if I e.g. need a speical layout for the table header, I
> must add a class or id attribute to the <th> elements of the headline
> (different layout on the left and right side e.g.).
> I can see no way to manipulate the generation of the headline. O.K. I can
> design my own Toolbar according to HeadersToolbar but in most cases that's
> much too compülicated. Is there an easy way to control the generation of
> the table head?
>  
> Stefan Lindner
> 
>  
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/wicket-user
> 
> 

-- 
View this message in context: 
http://www.nabble.com/DataTable-header-manipulation-tf2397492.html#a7237234
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to