Best Pratice: Show In A Detail View A Gridview Of A Related Table - How To?

I’m trying to do this, but I’m not able to do…

I’ve relation Client [1->N] Delivery

I’ve the detail view of client (’_view’).

I need to append here a filtered cgridview with all of delivery of this client.

This gridview can handle even thousands of rows, so it must be filtrable and sortable

How to step-by-step realize this ?

assume you have models: Client & Delivery link by client_id in Delivery model

in your Client model index view:


$criteria = new CDbCriteria;

$criteria->compare('client_id', $model->id);

$model_delivery = new Delivery('Search');

$dataProvider = new CActiveDataProvider($model_delivery, array(

	'criteria' => $criteria,

));



then use CListView or CGridView to display delivery for this client.

here come my question:

*** how could we make use of relation defined in Client model for this purpose in stead?

your solution work and I too ask:

*** how could we make use of relation defined in Client model for this purpose in stead? **