In developing the Digital Signature Field for SharePoint I wanted to add a graphic to clearly display the current state of the signature. Is the signature old, new or invalid? A coloured tick can convey this intuitively while economising on size.
Controlling the rendering of a custom field’s value in most display modes is straight-forward through overrides to the SPField method GetFieldValueAsHtml(object) and the Render(…) methods of BaseFieldControl. When it came to rendering the value on the list display (i.e. AllItems.aspx) I found that SharePoint limited me to doing this through the RenderPattern element in the field type definition XML, with the caveat that any values, properties or calculations be limited to the CAML View Schema elements. The MSDN documentation on Patterns of Custom Field Rendering hints that a DisplayTemplate specification will let you gain control of the display mode, including the list display. After messing around for a while I felt quite confident that it didn’t include the list display mode.
Some Googling later, I found someone who had bent the rules a little to achieve complete control over display list value rendering. This IconSet custom calculated field project uses a custom RenderPattern to generate a script reference to a custom aspx page that dynamically renders some document.write(…) code that then renders HTML. Values necessary to identifying which item and field are supplied by the CAML and passed by URL parameters.