Style cells in a list

Discussion in 'Community' started by arnor@icetips.com, Jun 16, 2017.

  1. arnor@icetips.com

    arnor@icetips.com 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
    upload_2017-6-16_11-25-42.png

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

    Best regards,
    Arnor
     
  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. arnor@icetips.com

    arnor@icetips.com 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,
    Arnor
     
  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
    tr.red td.your-element {background:some-color;}

    BTW:
    Why are you posting in the community formum if you have standard subscription?
    Threads in community forum are less monitored.
     
  5. arnor@icetips.com

    arnor@icetips.com 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,
    Arnor
     

Share This Page