Thank you for your help!!
I did it that way now:
public class MyDataTable extends DefaultDataTable
{
public MyDataTable(String id, List columns, SortableDataProvider
dataProvider, int rowsPerPage)
{
super(id, columns, dataProvider, rowsPerPage);
}
protected Item newRowItem(String id, int index, IModel model)
{
return new MyOddEvenElement(id, index, model);
}
}
public class MyOddEvenElement extends OddEvenItem
{
private String CLASS_EVEN = "even";
private String CLASS_ODD = "odd";
private String ON_MOUSE_OVER = "this.className='litupRowOver';";
private String ON_MOUSE_OUT_ODD = "this.className='odd';";
private String ON_MOUSE_OUT_EVEN = "this.className='even';";
public MyOddEvenElement(String id, int index, IModel model)
{
super(id, index, model);
}
protected void onComponentTag(ComponentTag tag)
{
super.onComponentTag(tag);
tag.put("class", (getIndex() % 2 == 0) ? CLASS_EVEN :CLASS_ODD);
tag.put("onmouseover", ON_MOUSE_OVER);
tag.put("onmouseout", (getIndex() % 2 == 0) ? ON_MOUSE_OUT_EVEN :
ON_MOUSE_OUT_ODD);
}
}
What do you think? Is that a reasonable approach?
/thomas
Gwyn Evans wrote:
> The problem you've not addressed is how you set the different
> 'onmouseout' functions in the repeater... I expect it can be done by
> extending the way that the OddEvenItem itself extends things, though.
>
> What I was thinking about was if there'd be a way of putting in a
> <span> or similar, such that the mouseovers could just do their set &
> clear, leaving the "odd/even" being set on the <tr>? While I don't
> know, I've got the impression that I'd run into issues as to what tags
> would actually be allowed where I'd need them in order to do that...
>
> /Gwyn
>
> On 06/09/06, Erik van Oosten <[EMAIL PROTECTED]> wrote:
>> The combination won't work.
>>
>> Try this for the even rows:
>>
>> <tr wicket:id="results" class="even"
>> onmouseover="this.className='litupRowOver';"
>> onmouseout="this.className='even';">
>>
>> and for the odd rows:
>>
>> <tr wicket:id="results" class="odd"
>> onmouseover="this.className='litupRowOver';"
>> onmouseout="this.className='odd';">
>>
>> I removed the class litupRow as it contains no style in your example. If
>> you want to maintain it do this:
>>
>> <tr wicket:id="results" class="litupRow even"
>> onmouseover="this.className='litupRowOver';"
>> onmouseout="this.className='litupRow even';">
>>
>> and for the odd rows:
>>
>> <tr wicket:id="results" class="litupRow odd"
>> onmouseover="this.className='litupRowOver';"
>> onmouseout="this.className='litupRow odd';">
>>
>> There are also javascript functions available on the net that allow you
>> to add and remove classes from an element.
>>
>> Regards,
>> Erik.
>>
>> --
>> Erik van Oosten
>> http://www.day-to-day-stuff.blogspot.com/
>>
>>
>>
>> Gwyn Evans schreef:
>>> I'm not sure enought of CSS and tables to be able to say if there's
>>> going to be any issues with trying to have both this and the Odd/Even
>>> classes working in the table row, though!
>>>
>>> /Gwyn
>>>
>>
>> -------------------------------------------------------------------------
>> 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
>>
>
>
--
Thomas Küchenthal
Technical Director
- Business Domain Management -
LEMARIT Domain Management GmbH
Werkstrasse 12
D - 24955 Harrislee / Flensburg
---------------------------------
Tel.Nr: +49 (0)461 / 5050 35 - 90
Fax Nr: +49 (0)461 / 5050 35 - 35
E-Mail: [EMAIL PROTECTED]
Domain: www.lemarit.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