We have a Silverstripe 4.x project which uses the following Dataobjects to create dynamic tables:
DataColumn
ColumnName
DataRow
RowID
DataCell
Value
has_one DataColumn
has_one DataRow
CMS Users can add/remove/edit columns - so we can't use a static Dataobject to represent this data.
However we would like to display this dynamic data in a Gridfield & export it as a CSV.
There are three possible approaches I can think of - but I'm not sure which one we should focus on (or whether there's a better way).
Approach #1: Create temporary Dataobject from dynamic data We could possibly create a temporary Dataobject in the database from the dynamic data. If we did this we could then display the temporary object in a Gridfield where it could be searched/ filtered/ exported etc. using the standard Gridfield functionality.
Approach #2: Transmute the dynamic data into a Gridfield
Could it be possible to transmute the dynamic data into a DataList
or ArrayList
that could then be displayed in a Gridfield? This is similar to approach #1 but is done on the fly, rather than creating a temporary Dataobject in the database.
Approach #3: Recode Gridfield functionality for dynamic data format This is the fallback but would involve the re-inventing of many wheels - so this is our last option if the other two aren't possible.
Which approach should we take? Is there existing functionality that can do what we're after?
Any guidance is appreciated.