List element heading label from data

I am trying to create a list to display a table of data, basing it on an SQL view. There are many data fields, far too many to display in a sensible number of columns, so the view will select a small set, controlled by other data; the list will have as many elements as the view selects. Each column needs a title that indicates which data has been selected (available with the selection data), rather the a label fixed in that element’s definition.

So far I have not found a way of doing this, though I suspect that using PHP code to modify $listModel may be a possibility. Since Fabrik can do most things, but it is easy to miss something, I wonder if anyone might have a good suggestion.
 
I'm not sure if I got your exact setup.

But I assume you can create a custom list template and modify default_headings.php
 
I could create a custom list template, but I do not think that would help.

The problem is that each column contains information related to a particular date, which I want to appear as the column heading. A date is entered (not the date of entry) and is stored in the database when each set of column data is entered, so I need a way of getting the date of each selected column (of the many available) from the database and into the list’s column headings.
 
I know (I think!) how to select, in the view, the rows and columns to be displayed, controlled by other data that the view can read from the database.

Also I can see that I could change the default headings to any fixed values using a custom default_headings.php, but probably not to values that depend on data that has to be fetched from the database with some PHP code – or is it actually possible to do that?

Looking at list.php (which I spent too long getting a bit familiar with when investigating an earlier problem), during list rendering the labels are set by a call to addLabels from getData/finesseData before the onLoadData event is run. Might onLoadData in the php_events plugin be a good place to put code to get the list’s data and make the changes to it that I want?
 
Thanks. That seems straightforward; I already have standard functions for fetching data. I was a bit doubtful about putting a lot of code in a template (I do not really know why), but if you say it is OK then it is OK. Thanks again for your help.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top