This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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: 15951
    
  19

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.
 
 
subject: Accessing a dataTable's row in javascript
 
Similar Threads
how to use indexid of logic:iterate tag in struts
JSF to Javascript
JavaScript
How to add a Table Row using JS
radio button using javascript DOM