jwerd
(Jacob)
March 21, 2013, 5:29am
1
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!
mirunho
(D Mirecki)
March 21, 2013, 7:14am
2
jwerd:
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!
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).
seenivasan
(Chellamnivas)
March 21, 2013, 11:20am
3
Dear Friend
You can use the CArrayDataProvider.
'dataProvider'=>new CArrayDataProvider($tracker->stats),
Regards.
jwerd
(Jacob)
March 21, 2013, 1:21pm
4
wow this worked perfectly. thank you man!