If I had two tables (Post and Comment) where a post had many comments, I could easily have a page showing each post in CGridView and make clicking on one of the posts take me to page showing related comments also in grid view.
However I was wondering if there were any solutions to show the related comments shown underneath its post in some sort of nested view.
I am new to Yii and am trying to do what you said was easy in the first part of your post. Can you please guide me how to do this? I have a department with many employees and I want to have a cgrid view of the employees when I click on a row in cgrid view of department. Thanks
Are talking about a CGridView of the departments, or of all employees? If just a department list, you can set the value of the column to a link to Employees with the selected department to view just those employees.
If a list of all Employees, then you could set up a dropdown list filter for the department column.
That extensions looks good but it’s not nested as such and it only includes the one model. I think I’ll write the HTML out in a for loop to achieve what I need.
Thank you very much for your prompt reply. I tried it and had to do some modifications because of the double quotes (btw is it normal? I had to replace the double quotes by single ones) Where must you define variable $dataProvider? Sorry I am new at Yii and am finding it hard to understand. Glad if you could help me. Thanks
Your issue is that you’re encapsulating the string in single quotes but then having the variables also in single quotes. PHP is unable to determine where your string starts and stops.