How to conditionally style a row in a rich:dataTable

后端 未结 7 1459
攒了一身酷
攒了一身酷 2021-02-07 02:12

How can I change the style of a particular row based on a condition? I can use JSF EL in rich:column style class attribute, but I have to write for each column. I want to change

7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-07 02:45

    I've done an hybrid solution with Javascript.

    
    
    Da evadere entro
                      
    
    
    

    and then in Javascript (with Prototype which is included in Richfaces)

    
    

    edit:

    this add a conditional css class with rendered:

    
    

    with javascript I loop on every td with css class expired $$('td.expired') and add the same css class to the upper node tr with el.up().

    Event.observe(window, 'load', function() {});
    

    this simply runs the function when the DOM is fully loaded.

提交回复
热议问题