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?
thanks!
Page 1 of 1
Getdata Enclosure On Relational Ar?
#2
Posted 21 March 2013 - 02:14 AM
jwerd, on 21 March 2013 - 12:29 AM, said:
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?
thanks!
'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?
thanks!
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).
#3
Posted 21 March 2013 - 06:20 AM
Dear Friend
You can use the CArrayDataProvider.
Regards.
You can use the CArrayDataProvider.
'dataProvider'=>new CArrayDataProvider($tracker->stats),
Regards.
Share this topic:
Page 1 of 1

Help












