Tip: Adding and removing columns on the grids

Started by tfs, September 26, 2011, 04:36:43 PM

Previous topic - Next topic

tfs

I wanted to have the Assigned User column on the [Tickets Awaiting User Response] grid.  And, I wanted to adjust the column widths a little bit to compensate.  Here's how I did it.

DISCLAIMER: Do this at your own risk.  No support is promised for this, and if you're clumsy, you just may mess up something important.

To add a column to a grid:

Edit /Sources/sd_source/SimpleDesk.php.  The last function in the file is shd_get_block_columns($block), which is the function that stipulates which columns are in each grid.  The [Tickets Awaiting User Response] grid is called "user_staff."  So locate this section...

case 'user_staff':
return array(
'ticket_id',
'ticket_name',
'starting_user',
'last_reply',
'replies',
'urgency',
'updated',
'actions',
);



And add the assigned column.  The new function looks like this...

case 'user_staff':
return array(
'ticket_id',
'ticket_name',
'starting_user',
'last_reply',
'assigned',
'replies',
'urgency',
'updated',
'actions',
);


...and that's all there is to it.  You have modified SimpleDesk.php and added the column.

If you also want to adjust the width of some of those columns, here's how.

Edit the file /Themes/default/sd_template/SimpleDesk.template.php.  (Assumes you're using the default theme)  Scroll down to line 415 and you'll see a section that defines the widths for each column.  You can change the width="nn%" values to resize your columns.  Note that all of the values combined do add up to over 100%, which is OK.  But as a general rule, as you add width to one column you should remove from others.

A good tree cannot bring forth evil fruit, neither can an evil tree bring forth good fruit.