Background colouring columns

Background colouring columns

dp@ii.netdp@ii.net Posts: 38Questions: 10Answers: 0

Seems that colouring rows is popular but not so much columns.

I wanted to be able to colour columns such that they are grouped together in sections - to mirror how spreadsheets are often used.

I'd like the sort-select-click to go grey like now, but return to the configured background colour when sorting on another column.

I imagine that I would need to add a class to a column and that class would have a colour in the CSS file - but wonder if someone has already done this.

I already use a couple of extra classes to control the inline editing onClick and also to enable the searchable form/drop down at the bottom of some columns - so any new classes I add to configure background colours would need to cope with this. Just worried that I cannot have a cell belong to multiple classes ??

thanks!

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,744Questions: 1Answers: 10,111 Site admin
    Answer ✓

    You can have multiple classes assigned to columns by just space seperating the class names. Then in your CSS you could do:

    td.myClassGroup1 {
      background-color: green;
    }
    

    etc.

    You might need to be careful when considering the impact upon row selection highlighting (assuming your table has that). That will likely require additional CSS, but that is the basic idea.

    Allan

This discussion has been closed.