Style cells in a list

Discussion in 'Community' started by, Jun 16, 2017.

  1. Member

    Level: Community
    Hi guys,

    Is it possible to style certain cells in a list?

    I have a list where I would like on certain condition to style several columns in a single row with a red(ish) background indicating a problem. Something like the attached screenshot

    In this case then cells are colored red if the date in C doesn't match the date in A. Same concept.

    Best regards,
  2. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Professional
    No simple way to do that. We have a 'use as row class' setting on elements, where you can add the value of that element as a class name on the row, but that won't work for your case, of comparing one value against another.

    The only "simple" way I could think of would be to add a calc element, which compares the two elements, and returns 'red' (or whatever) if they are different, and set "use as row class" on that.

    Then add a custom_php.css on your template which defines the class.

    Other than that, you'd have to either do it in JS or a custom template, neither of which are trivial.

    -- hugh
  3. Member

    Level: Community
    Hi Hugh,

    Thanks! The "use as row class" applies to the entire row and is applied to the <tr>, doesn't it? We were hoping that we could apply it only to part of the list, but if we have to use the entire row, we can do that :)

    Best regards,
  4. troester

    troester Well-Known Member Staff Member

    Level: Standard
    You can use it for single cells only by additionally using the cell class (= full element name), somthing like td.your-element {background:some-color;}

    Why are you posting in the community formum if you have standard subscription?
    Threads in community forum are less monitored.
  5. Member

    Level: Community
    Hi Hugh,

    Thanks for that! Will play with it and see where it leads me.

    As for posting, I've never noticed ;)

    Best regards,

Share This Page