cgridview working with join tables to create dynamic columns

Ok looking more for a strategy before I get farther, cause I keep running into issues.

Using CGridView to create a table layout, pretty standard. Here is my schema:

leads:

id, vertical_id, name, etc.

verticals:

id, name, etc.

fields

id, vertical_id, etc.

fields_leads

field_id, lead_id

I need to make essentially what something like adodb would call a PivotTable, where the end result would be:

id - first_name - last_name - email - custom field 1 - custom field 2 - custom field 3 etc.

the values for each column will have to be populated via the fields_leads table, and eventually sorted etc.

I could do this without using the cgridview, but figured since I’m using it so much in other places, why not continue using it, but ran into this issue and just need to see if anyone has done this yet.

I started by dynamically generating the columns property passed to cgridview, and then overriding the __set method of the Leads model so that I could dynamically create ‘fields’, but then when trying to display, the __get method when called never sees the fields_leads loaded correctly. I’m trying to avoid just pasting a bunch of code, hopefully someone gets the idea.

Hi. Did you have any luck solving this?

me looking for this solution either. Do you already have the solution for this?