How to display the renderSummary() when renderPartial to a _view

Hi!

I have two table: produit, and categorie. I want to display produit data by category using relation "produits" from table category, using foreach in my view categorie like:




    foreach($model->produits as $produit) 

    {

    $this->renderPartial('/produit/_view',array('data'=>$produit));

    }

    

In Categorie controller:




    public function actionViewcateg($id)

    {

    $this->render('viewcateg',array(

        'model'=>$this->loadModel($id),

    ));

    }

    

My problem is I want to display the renderSummary() and renderPager() from CBaseListView widget. How can I do that?

I’v tried to use CActiveDataProvider but I don’t know how to select data from the relation.

Thank you in advance!

Just want to understand U right:

U want to show all produits from one categorie ?

Also U want to use pagination?

yes that’s it. the produits from categorie are showed but i want use summary and pagination from widget CListView. please help

okay here just replace your ProductController/actionIndex with this change your variable and column names accordingly and you should be good to go


public function actionIndex($category = '')

	{

		// remember now this $category is your category ID from categories table

		// so when you creating the links you have to pass in the category ID like so

		// /products/index?category=1 

		$criteria = new CDbCriteria;

		if (!empty($category)) {

			$criteria->join = "JOIN categories c ON t.category_id = c.id";

			$criteria->compare("c.id", $category);

		}

		$dataProvider = new CActiveDataProvider('Product', ['criteria' => $criteria]);

		$this->render('index', compact('dataProvider'));

	}

Thank you very much friend! it works!