Wilbo
(W Ellor)
1
Hi,
I have a table with two columns: user_id and post_id, linking certain users to certain posts.
How do I get the data from the posts table for a certain user and display each result in a CGridView?
I suppose my question is how do I construct the dataProvider?
I’m guessing a for each loop will be involved?
I have relations set up in the models for posts and users
Thanks in advance!
Wilbo
(W Ellor)
2
OK, after some more search found this amazing post which gives a great example of how to reference data from Many to Many relationships.
Now I just have to work out how to put it into a dataprovider. Any help with this would be greatly appreciated!
gerhard
(gerhard@ecolar.co.za)
3
Hi Wilbo
Try this wiki: Dynamic Parent and Child gridviews.
The users can be in the parent gridview, and each user’s posts can be in the child gridview.
Wilbo
(W Ellor)
4
Hi Gerhard, thanks very much, I’ll give that a read through.