GeeCON Prague 2014*
The moose likes JSF and the fly likes Datatable rows onMouseOut color change Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » JSF
Bookmark "Datatable rows onMouseOut color change" Watch "Datatable rows onMouseOut color change" New topic
Author

Datatable rows onMouseOut color change

Augustine Chelliah
Greenhorn

Joined: Mar 12, 2009
Posts: 28
hi,

I have a problem in applying colors for data table.

I have given rowClasses="oddRow , evenRow". These classes contain different bg colors. So while rendering I'll get alternate colors for rows.

My requirement is to have a third color for rows while 'onmouseover'. So I had ' rowOnMouseOver="thirdColor" '. Now on mouse out, I need to get the same alternate colors for odd and even rows. I dont know how to give onmouseout for oddrows and evenrows seperately

I'm using tomahawk's datatable. Please help.

Augustine


Thanks & Regards,
Augustine
Ravi Kumar
Greenhorn

Joined: Sep 07, 2005
Posts: 24
Hi,

I am using the following to print the same requirement using t:dataTable.

rowClasses="even,odd"
rowOnMouseOver="this.style.backgroundColor='#9ACD32';"
rowOnMouseOut="this.style.backgroundColor='#{tableBackgroundColor}';"

Thanks
Augustine Chelliah
Greenhorn

Joined: Mar 12, 2009
Posts: 28
hi,

Thanks for the reply. I did not get what 'tableBackgroundColor' is in "rowOnMouseOut="this.style.backgroundColor='#{tableBackgroundColor}';""... Is it like we need to have color in backing bean or ...?? Can you please elaborate.
Augustine Chelliah
Greenhorn

Joined: Mar 12, 2009
Posts: 28
hi,

I got it.

rowOnMouseOver="if (!this.oldClassName){this.oldClassName=this.className;} this.className='dataRowHover'"
rowOnMouseOut="this.className=this.oldClassName"

I tried this in mine. It worked. I'm sure it'll work for any style class.
I got this logic in a mail-archive site from apache.org
 
GeeCON Prague 2014
 
subject: Datatable rows onMouseOut color change