Parent Detail / Child List Display

I’m evaluating Yii for a project I’m working on. I’ve used other frameworks such as CodeIgniter for this type of thing, but can’t seem to get my head wrapped around how to do this in Yii.

The data in the project has a cascading structure:

Organizations have many locations.

Locations have many employees.

Employees have many notes.

Here’s how I would like to have things work:

  1. The first page would be a listing of Organizations

  2. After selecting an organization, the user would go to the detail view of the organization. Below the detail for the organization would be a searchable list of locations.

  3. The user could then select a location, go to the detail view of the location and find a searchable list of the employees at the bottom.

  4. The use could select an employee, go to the detail view, and find the employee detail and a list of notes on that form. Selecting a note would simply go to a detail view for the note.

It seems that this should be a simple thing to do, but I’ve not been able to get it to work. Parent / Child relationships where Parent Detail and Child List should be pretty common - Sales Orders, Invoices, Contacts, Inventory.

Any help will be greatly appreciated. I’ve been really impressed with Yii, and hope this does not become a showstopper. I’ve attached a document that better illustrates what I want.

Thanks in advance!

BTW - I’ve got the Databases worked out and the relationships working. I can created a drop-down list on the detail form that contains the correct data. I just can’t figure out how to display this information in a searchable table.

use CGridView

I’ve been racking my brain trying to figure this out. I’ve searched everything that I can find, downloaded all the examples I can find. I cannot find a working example. Implementing cActiveDataProvider and CGridView on the parent side of the equation seems easy enough. Getting a filtered CGridView in a different view from the parent detail is also a piece of cake.

Does anybody have an example of how to display the child records in a CGridView on the same page as the detail view of the parent? For instance, I’ve created a function in /models/ORG/model.php like this:


public function getSites()


return new CActiveDataProvider( Ste::model(), array ('criteria' => array ('with'=>'sTEORG',),'pagination' => array ('PageSize' => 10,)));	



The CGridView is defined as follows in the /views/ORG/view.php file.


$this->widget(‘zii.widgets.grid.CGridView’, array(













At this point there is no filtering. I’m just trying to get the records to appear in the grid. The getSites() function triggers, but when it tries to populate the grid I get an error:


Property "ORG.STE_ID" is not defined.


STE_ID is the primary key in the STE table, which is what I want to display in the grid. Not sure why it’s trying to reference STE_ID in the ORG table.

Any Ideas?

[color="#006400"]/* Moved to General Discussion */[/color]