-
1. Re: rich:dataTable highlight rows on click and when hovering
ilya_shaikovsky May 8, 2009 8:15 AM (in response to bartholodeus)1) you should just store the selected td element in some js var and on other row click change its styling back.
2) just add proper if statement.
b.t.w. just html/css/js question... there are answers around the web on the proper resources. Just few random links from our bestr friend google :)
http://www.htmlhelpcentral.com/messageboard/showthread.php?t=9140
http://www.permadi.com/tutorial/cssHighlightTableRow/index.html -
2. Re: rich:dataTable highlight rows on click and when hovering
svande May 25, 2009 10:32 AM (in response to bartholodeus)<rich:jQuery selector="#contractsReport tr" query="mouseout(function(){jQuery(this).removeClass('active-row')})"/> <rich:jQuery selector="#contractsReport tbody tr" query="click(function(){jQuery(this.siblings()).removeClass('selected-row');jQuery(this).addClass('selected-row')})"/>
-
3. Re: rich:dataTable highlight rows on click and when hovering
anonyin Aug 2, 2011 2:20 PM (in response to svande)Wilfred,
Can you give the complete code for this please, including the dataTable, I am not familiar with jQuery so not sure where to add this snippet you have provided. Thanks for your help.
Thanks
Kiran.
-
4. Re: rich:dataTable highlight rows on click and when hovering
anonyin Aug 2, 2011 4:14 PM (in response to anonyin)Wilfred,
I could get it to work but siblings() function is not working. Its complaining as it is(siblings()) not supported. Any idea ?
Thanks
Kiran.
-
5. Re: rich:dataTable highlight rows on click and when hovering
colingaj Sep 22, 2011 10:10 AM (in response to anonyin)I think there was a small typo. It should be:
<rich:jQuery selector="#contractsReport tbody tr"
query="click(function(){jQuery(this).siblings().removeClass('selected-row');jQuery(this).addClass('selected-row')})"/>Correction is highlighted and underlined.
-
6. Re: rich:dataTable highlight rows on click and when hovering
gangadharivv Sep 23, 2011 3:03 AM (in response to bartholodeus)Why dont you use extended table by disabling the un-necessary features
-
7. Re: rich:dataTable highlight rows on click and when hovering
ilya_shaikovsky Sep 24, 2011 4:55 PM (in response to gangadharivv)I guess because it's still more heavyweight for simplest cases. Easier to add selection to dataTable.
-
8. Re: rich:dataTable highlight rows on click and when hovering
croco Jul 18, 2012 4:05 AM (in response to bartholodeus)Solution that worked for me, might be useful for someone. I have a zebra table using rowClasses="rowOdd, rowEven"
Hovering effect:
.rich-table-row:hover {
background-color: ROW_COLOR;
}
Row selection:
.row-selected {
background-color: ROW_COLOR;
}
<rich:jQuery selector="#TABLE_ID tbody tr:even" query="click(function(){jQuery(this).siblings().removeClass('row-selected');jQuery(this).removeClass('rowEven');jQuery(this).addClass('row-selected')})"/>
<rich:jQuery selector="#TABLE_ID tbody tr:odd" query="click(function(){jQuery(this).siblings().removeClass('row-selected');jQuery(this).removeClass('rowOdd');jQuery(this).addClass('row-selected')})"/>
This two tags go under the <rich:table> as described in http://docs.jboss.org/richfaces/latest_3_3_X/en/devguide/html/rich_jQuery.html