I’m am just wondering if I can use CGridView to display the number of relations a user has, eg display the number of posts each user has made? I’ve related the ‘users’ and ‘posts’ tables fine and I can pull details of any related post from the ‘posts’ table without a problem for any given user, but I don’t know how to sum them using CGridView, so it displays something like:
Username Posts
Foo 11
Bar 45
I don’t want to make the total number of posts a link or anything, I just want to display it as a number in the CGridView table for reference.
This puts the postcount column in, but it’s always 0. I think it’s the ‘params’ line that’s not pulling the $model->id for each line, but is sending through to CGridView with value 0, so it’s looking for all posts with user_id as 0, hence no results?