views:

542

answers:

2

Hi,

I'm problem with defining a mouse over effect for my datatables. I have

<a4j:form>
    <rich:dataTable id="dataTable"> ... </rich:dataTable>
    <rich:datascroller id="dataScroller" for="dataTable" />
</a4j:form>

<rich:jQuery selector="#dataTable tr" query="mouseover(function(){jQuery(this).addClass('active-row')})"/>
<rich:jQuery selector="#dataTable tr" query="mouseout(function(){jQuery(this).removeClass('active-row')})"/>

which are working fine on the very first page. However if I use the datascroller to goto another page, the mouseover effect is gone.

I've tried reRendering the table or the jQuery components, that didn't help with the problem at all.

Any suggestion on how I can get this working?

Thanks!

A: 

Not sure if this will work but its worth a try. I have never used richfaces, but jQuery live events bind to all elements including future elements appended to the DOM.

<rich:jQuery selector="#dataTable tr" query="live('mouseover', function(){jQuery(this).addClass('active-row')})"/> 
<rich:jQuery selector="#dataTable tr" query="live('mouseout', function(){jQuery(this).removeClass('active-row')})"/>
John Hartsock
It didn't work :(
John
watch out with the quotes.. it might be the one causing it not to work..
Reigel
thanks Reigel. I corrected my answer.
John Hartsock
Yeah, I've corrected the quotes in trying it out. The table rows on other pages doesn't seem to be stored on the page at all, until the page is loaded...I'm trying to have it reapply the jQuery function on load...
John
A: 

Hi john , I was new to this richfaces and seam ,but i am very much interested to develop seam application with richfaces frontend . I am also facing the same problem for rich:datatables rows on next page when i click on scroller of that table. So can you send/show me the modified jQuery code to by which you can fixed this problem?

Thanks in advance Sathish

sathish
hi, the problem can be worked around by defining the action on the actual rich:dataTable component. i.e. <rich:dataTable ... onRowMouseOver="highlight(this)" onRowMouseOut="dim(this)"> ... </rich:dataTable>
John