Edgewall Software

Opened 9 years ago

Last modified 3 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:
Release Notes:
API Changes:


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 Changed 9 years ago by sid

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:

<tr class="color3-odd">
    <td class="type">defect</td>
    <td class="ticket">
      <a title="View ticket" href="/ticket/3868">#3868</a>
    <td class="summary">
      <a title="View ticket" href="/ticket/3868">Post action and fastcgi 'Broken pipe' problem.</a>
    <td class="component">general</td>
    <td class="version">0.10.2</td>
    <td class="severity">normal</td>
    <td class="owner">jonas</td>
    <td class="status">new</td>
    <td class="lastmodified">40 days</td>
    <td class="chgs_auths">15 by 9</td>

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.

comment:2 Changed 9 years ago by Christian Boos

Resolution: worksforme
Status: newclosed

See also #6158.

comment:3 Changed 9 years ago by Matt Young

Resolution: worksforme
Status: closedreopened

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:

  (CASE priority 
    WHEN 'major'  THEN 'background: #FF6666' 
    WHEN 'normal' THEN 'background: #FFFFCC' 
    WHEN 'minor'  THEN 'background: #FFFFFF' 
    ELSE 'background: #33FFFF' 
  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 class="even" style="background: #FFFFFF;">
  <td class="version">0.10.2</td>
  <td class="severity">minor</td>
  <td class="owner">jonas</td>

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 Changed 9 years ago by Remy Blank

Milestone: 2.0
Owner: Matthew Good deleted
Status: reopenednew

comment:5 Changed 7 years ago by Christian Boos

Milestone: 2.0unscheduled

Milestone 2.0 deleted

comment:6 Changed 3 years ago by robert.galliers@…

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>
Last edited 3 years ago by Jun Omae (previous) (diff)

comment:7 in reply to:  6 Changed 3 years ago by Ryan J Ollos

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.

Modify Ticket

Change Properties
Set your email in Preferences
as new The ticket will remain with no owner.
The ticket will be disowned.
as The resolution will be set.
The owner will be changed from (none) to anonymous.

Add Comment

E-mail address and name can be saved in the Preferences .

Note: See TracTickets for help on using tickets.