For the records: My first approach worked well until the DataTable hit an empty 
list. In that case, newCellItem is never called as there is no data to be 
displayed. Hence the still visible table headers had wrong widths. I had to 
create a copy of HeadersToolbar and add the line

header.add(new SimpleAttributeModifier("class", "col" + i));            

Now I can apply the css width settings to the th tags.


-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von 
MailingWicketUser
Bereitgestellt: Donnerstag, 13. April 2006 13:30
Bereitgestellt in: User
Unterhaltung: [Wicket-user] Setting column-widths in DataTable
Betreff: AW: [Wicket-user] Setting column-widths in DataTable



Thank's for you feedback! 

Skimming thru the javadocs of the DataTable classes I overlooked the 
newCellItem method in DataTable. Overwriting this I can now add css-class 
attributes to the td tags using the following code:

DataTable dataTable = new DataTable("table", columns, dataProvider, 
rowsPerPage) {
    protected Item newCellItem(String id, int index, IModel model) {
        Item item = new Item(id, index, model);
        item.add(new SimpleAttributeModifier("class", "col" + index));
        return item;
    }            
};

Regards,

Timo Verhoeven

-----Ursprüngliche Nachricht-----
Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Juergen 
Donnerstag
Bereitgestellt: Donnerstag, 13. April 2006 11:58 Bereitgestellt in: User
Unterhaltung: [Wicket-user] Setting column-widths in DataTable
Betreff: Re: [Wicket-user] Setting column-widths in DataTable


I guess there are plenty of HTML and CSS ref and tutorial pages out there:
http://www.selfhtml.org/
http://www.w3schools.com/html/
http://www.w3schools.com/css/default.asp

Juergen

On 4/13/06, MailingWicketUser <[EMAIL PROTECTED]> wrote:
>
>
>
> Hi!
>
> Is there an "elegant" way to set the column widths when using a 
> DataTable (from wicket-extensions)? As this is a matter of design, I 
> anticipate a solution where I can set the widths in HTML or CSS.
> Something like the following would be nice:
>
> <table wicket:id="table">
>   <colgroup>
>     <col width="100" />
>     <col width="100" />
>   </colgroup>
> </table>
>
> Regards,
>
> Timo Verhoeven


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language 
that extends applications into web and mobile media. Attend the live webcast 
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language 
that extends applications into web and mobile media. Attend the live webcast 
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to