Doubt on using CGridView for manage data

Hi everyone, I’m new using Yii and I consider it marvelous!

I’m doing a site for keeping data of games on handheld devices (like the nintengo gba and ds).

Well, I have the default ‘admin’ action/model/view course as it in the blog demo example.

Like this:

2152

ss1.png

As you see, I’ve included a dropbox to select the category of games I want to manage.

My question is… how can I pass a $_GET parameter (category name) to the action, so it can load and then show the same CGridView but using ONLY the data pertaining that category. (Something like ‘admin/category’)

Hope you guys can help me on this, sorry for my english, I’m not a native.

If you see:




<?php

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

        'id' => 'news-grid',

        'dataProvider' => $model->search(),

        'filter' => $model,

        'columns' => array(

            ...

            array(

                'class' => 'CButtonColumn',

            ),

        ),

    ));

?>



the dataProvider is the search method of you model, so … find this method in your model and change the criteria of search. Your data will be filtered.

Oh, I see… I should use ‘scenarios’ with params.

Many thanks!