Peoplecode PeopleTools

Sortable Image Column in PeopleTools Grid

A quick tip if you want to allow users to sort on an Image column in a PeopleTools grid. Typically this is used in RAG (Red Amber Green) type traffic light images for KPI/target values. The tip is simple but effective:

Don’t use an Image column type – use an HTMLAREA and embed a hidden value into a HTML comment in the column followed by a link to the image you want to display.

Given a HTML area linked to RECORD.MY_FIELD on the grid, use RowInit PeopleCode to construct the HTML like this:

RECORD.MY_FIELD.Value = '<!--' | {the_value_to_sort_on} | '-->' | "<img src='%Image(MY_IMAGE)'>";

where the “value to sort on” could be a literal or a RECORD.FIELD.Value reference or indeed any calculated value. Just make sure the values you assign reflect the collating sequence you want for the images.

Oh … you might want to centre the image in the column using a DIV

<div style=”text-align: center;”>

… the img tag above



One reply on “Sortable Image Column in PeopleTools Grid”

It might be obvious, but if you are sorting on a numeric value in the comment you need to pad it to a consistent format with the necessary leading zeroes … e.g. 001,002,099

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.