Skip to main content
2 of 3
deleted 44 characters in body; edited title
battery.cord
  • 8.9k
  • 8
  • 33
  • 59

Visualforce dynamic sObject table column value formatting

I want to allow my team to display some leads and tasks (and any known object) with custom conditions and display all the data on only one screen. I made some custom objects "blocks" containing SOQL elements :

  • base query ; ex: select * from lead where createdDate = TODAY
  • headers ; ex: Name, CreatedDate, id

I have a controller that get all those blocks then get all the records in wrappers with a list of headers and a list of those sobjects.

Then I have a visualforce page that use repeat vf command :

  • repeat on all wrappers to create tables
  • repeat on all headers to create the table header then fill the rows & 1st column is a link to the record

This way my team can work on only one screen with data we want.

But I would like to be able to format the output value, depending on the type. Obviously for dates and datetimes.

I am just thinking about one thing : I could use a map of headers instead of a list, something like:

key = header, value = type. GetHeaders => return List<String>(headers.keySet()) 

So in my columns i could check the type to use some formated output values.

Guillaume
  • 115
  • 1
  • 13