Opened 17 years ago
Last modified 10 years ago
#7199 new enhancement
Colour/style individual cells in ticket report
Reported by: | Matt Young | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | unscheduled |
Component: | report system | Version: | 0.10.4 |
Severity: | normal | Keywords: | |
Cc: | Branch: | ||
Release Notes: | |||
API Changes: | |||
Internal Changes: |
Description
Trac reports allow you to apply a colour or style to each row of the results, but not to individual cells in the row. It would be very helpful to allow different cells in the same row to be coloured differently. Then we could have, eg, one set of background colours for the "Priority" field and another for the "Status" field.
Attachments (0)
Change History (7)
comment:1 by , 17 years ago
comment:3 by , 17 years ago
Resolution: | worksforme |
---|---|
Status: | closed → reopened |
The solution proposed above doesn't actually work. The point is that, because of the way the __style__
attribute of a query is applied, you can't use CSS to make a colour apply to a single cell. The style gets inserted directly in the TR tag. Eg if your query contains something like the following:
SELECT ... (CASE priority WHEN 'major' THEN 'background: #FF6666' WHEN 'normal' THEN 'background: #FFFFCC' WHEN 'minor' THEN 'background: #FFFFFF' ELSE 'background: #33FFFF' END) AS __style__ FROM ...
then you end up with HTML like this:
<tr class="even" style="background: #FF6666;"> ... <td class="version">0.10.2</td> <td class="severity">major</td> <td class="owner">jonas</td> ... </tr> <tr class="even" style="background: #FFFFFF;"> ... <td class="version">0.10.2</td> <td class="severity">minor</td> <td class="owner">jonas</td> ... </tr>
What we need is for some way in the query to be able to change the class name (rather than the inline style) of each table row. Then, as you say, we would be able to do per-cell colouring with CSS.
This is important to allow different cells in the same row to have different colours — eg you might very well want one colour for severity and another for priority.
comment:4 by , 16 years ago
Milestone: | → 2.0 |
---|---|
Owner: | removed |
Status: | reopened → new |
follow-up: 7 comment:6 by , 10 years ago
I have run up against this problem too. Any likelihood of this being fixed?
My query contains:
status,(CASE status WHEN 'testing (lab)' THEN 'background: orange; color: white' WHEN 'testing (integration)' THEN 'background: !#4EA24E; color: white' WHEN 'closed' THEN 'background: darkgreen; :white; color: white' WHEN 'reopened' THEN 'background: #FF3030; color: white' ELSE '' END) AS __style__,
And returns:
<tr class="even" style="background: !#4EA24E; color: white;"> <td class="ticket">...</td> <td class="summary">...</td> <td class="status">...</td>
When what I really need is:
<tr class="even"> <td class="ticket">...</td> <td class="summary">...</td> <td class="status" style="background: !#4EA24E; color: white;">...</td>
comment:7 by , 10 years ago
Replying to robert.galliers@…:
I have run up against this problem too. Any likelihood of this being fixed?
PatchWelcome. There are currently 1000+ tickets open, so you can imagine that we have our hands full and unless one of the core developers is personally motivated to fix it, we will probably spend our time on one of the infinite number of other features that could be worked on. That is, unless a quality patch is provided.
This is easy to do with CSS. Each table cell has a defined class, so you just set colors for the classes you want to change.
Here's an example HTML row from a report:
I don't think this type of color styling is widely useful or desired. And it is quite easy to change for your site. Propose closing as
worksforme
.