How to assign custom CSS class to arbitrary arbitrary rows of h:dataTable?

后端 未结 2 1257
抹茶落季
抹茶落季 2020-12-21 05:53

I\'m trying to assign a specific CSS class to specific rows of my . Is there some way to access and cutomize the resulting table rows?

2条回答
  •  执笔经年
    2020-12-21 06:21

    I like @BalusC suggestion. If you want a second alternative, you can do this easily with javascript/JQuery.

    With JQuery you can do it like this

    (Note, this is just an example. I haven't tested it, and there is probably a better way of doing it)

    $(document).ready(function(){
      var counter = 0;
      $('#myTable').each(function() {
          counter = counter + 1;
          if(counter==3) {
            $(this).addClass('redRow');
            return;
          }
    
      });
    }
    

提交回复
热议问题