aspose file tools*
The moose likes JSF and the fly likes Accessing a dataTable's row in javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Accessing a dataTable Watch "Accessing a dataTable New topic
Author

Accessing a dataTable's row in javascript

Fawad Ali
Ranch Hand

Joined: Dec 28, 2009
Posts: 112
Hello All,
I need to change the color of a row through javascript on mouseover. How can I get the row object of datatable by bringing mouse over the row.


Regards, Fawad Ali.
Software Engineer, Stafona Inc. - My Blog
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16058
    
  21

I'm not sure you need JavaScript to do that. I think CSS alone will handle it. You just need to define an approprate CSS class in the table's rowClasses attribute.


Customer surveys are for companies who didn't pay proper attention to begin with.
Fawad Ali
Ranch Hand

Joined: Dec 28, 2009
Posts: 112
Hello Tim,
Thanks a lot for your reply. You provided a lot of help since I joined. Well I tried a css class but its not working. I tried some thing like this

.blue{
background-color:#DBE5F5;
}
.blue:hover{
background-color:#00FF00;
}

and in dataTable

<h:dataTable value="#{viewAllInvoicesBean.invoicesList}" var="invoice" rowClasses="blue" >

but its not working. Thats why I asked for javascript access. Besides the hovering feature never works in Internet Explorer, that is why again I am going for javascript access.
 
jQuery in Action, 2nd edition
 
subject: Accessing a dataTable's row in javascript