Current Record: Customizing_the_look_and_feel_of_a_row_or_a_cell #62

How to customize the look and feel of elements in the list view Create a method in a delegate class In the delegate class, the method css_...

Current Record: Customizing_the_look_and_feel_of_a_row_or_a_cell #62

How to customize the look and feel of elements in the list view Create a method in a delegate class In the delegate class, the method css_...

Customizing_the_look_and_feel_of_a_row_or_a_cell

[Permalink]

How to customize the look and feel of elements in the list view

Create a method in a delegate class

In the delegate class, the method css__tableRowClass is implemented, like in this example :

class tables_journal_interventions {
function css__tableRowClass(&$record){
    if ( !$record->val('fermeture')){
        return 'intervention_close';
    }
    else return '';
} 
}

Here the function tests a condition : is there a value in the field fermeture ?

Add the class in a CSS stylesheet

Now the class is created in a CSS stylesheet.

td.intervention_close {
        background-color: #FFE6E6 !important;
    } 

This is a class for each cell, the <td> tag. The !important attribute is added to be sure that this information has precedence over all the others. It is better to add this class in a custom CSS stylesheet.

Remarks

Beware that some versions of IE don't respect the background-color property on the <tr> tag, so it is probably better to write:


    tr.intervention_close td {
        background-color: #FFE6E6;
    }

i.e. to apply the background color to the individual cells.

blog comments powered by Disqus
Powered by Xataface
(c) 2005-2024 All rights reserved