Skip to content Skip to sidebar Skip to footer

Highlight Row Of Jsf Datatable

I want to highlight row into JSF table when the mouse pointer is on the row. I found this tutorial. I tried to implement the example here:

Solution 1:

The problem is, that your script gets executed before the DOM is completely loaded.

You can either put your script as it is at the bottom of the page or call it when the document is ready by putting it inside $(function() {}):

<scripttype="text/javascript">
  $(function() {
    $("tr").not(':first').hover(
      function () {
        $(this).css("background","yellow");
      }, 
      function () {
        $(this).css("background","");
      }
    );
  })
</script>

Solution 2:

You can use these js action call in dataTable:

onrowmouseover="this.style.cursor='default';this.style.backgroundColor='#F1F1F1';"onrowmouseout="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'"

Post a Comment for "Highlight Row Of Jsf Datatable"