Win a copy of Spark in Action this week in the Open Source Projects forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Datatable rows onMouseOut color change

 
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
 
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
 
Destiny's powerful hand has made the bed of my future. And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic