Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Datatable rows onMouseOut color change

 
Augustine Chelliah
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ravi Kumar
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic