dv
unread,Jan 28, 2012, 6:28:07 PM1/28/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Google Visualization API
Hey all,
I need to custom a table row based on whether the value of one of the
cells is an even or odd number. So after table is created, I add this
line of code:
$('.google-visualization-table-td-number').each(function(){ $
(this).html()%2==0 ? $(this).parent().css('background-color','red !
important') : $(this).parent().css('background-color','blue !
important') });
I inspect in google chrome browser and indeed the background color is
applied to the table row. But it's not actually rendering the color
for the table row in the browser. Thats because whatever value is set
in .google-visualization-table-tr-even and .google-visualization-table-
tr-odd classes is overriding my background style.
So I do this:
$('.google-visualization-table-tr-even').removeClass('google-
visualization-table-tr-even');
$('.google-visualization-table-tr-odd').removeClass('google-
visualization-table-tr-odd');
$('.google-visualization-table-td-number').each(function(){ $
(this).html()%2==0 ? $(this).parent().css('background-color','red !
important') : $(this).parent().css('background-color','blue !
important') });
And it works, the colors display right, but as soon as I hover over
one of rows, the .google-visualization-table-tr-even and .google-
visualization-table-tr-odd classes come back and the backgorund-color
goes away.
Any good way to fix this problem?
thanks for response