Getdata Enclosure On Relational Ar?

I have a HAS_MANY relation but I want to put it into a CGridView from within call, eg:

‘dataProvider’=>$tracker->stats, but when I set this I get the following error:

Fatal error: Call to a member function getData() on a non-object

But I can access them via Tracker->stats[0]->field.

Is there anyway to set this up so Cgridview can still be used?


Stats is array in this case. You can set data ‘dataProvider’=>$tracker and than display value of every stats with some function (because You have to change array to string).

Dear Friend

You can use the CArrayDataProvider.

'dataProvider'=>new CArrayDataProvider($tracker->stats),


wow this worked perfectly. thank you man!