problems using two CDataGrid on same View

Hello

i am new in yii , i am having problem in using CGridView on same page.

following is the scenario and code examples of what i am doing , so that you guys can understand my problem.

i have two Models Category and Product with corresponding controllers as category and product ,

in product controller there is an action named action actionManagement





    public function actionManagement() {

        $model = new Product('search');

        $model->unsetAttributes();  // clear any default values

        if (isset($_GET['Product']))

            $model->attributes = $_GET['Product'];


        $categoryModel = new Category('search');

        $categoryModel->unsetAttributes();  // clear any default values

        if (isset($_GET['Category']))

            $categoryModel->attributes = $_GET['Category'];




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

            'model' => $model,

            'categoryModel'=>$categoryModel,

        ));

    }



now in its view




<?php


/**

 * @author rasikh.mashhadi

 */

$this->menu = array(

    array('label'=>'Add Product','url'=>array('product/create')),

    array('label'=>'Add Category','url'=>array('category/create')),

);


Yii::app()->clientScript->registerScript('searchCategory', "

$('.category-search-button').click(function(){

	$('.category-search-form').toggle();

	return false;

});

$('.category-search-form form').submit(function(){

	$.fn.yiiGridView.update('category-grid', {

		data: $(this).serialize()

	});

	return false;

});

");


Yii::app()->clientScript->registerScript('searchProduct', "

$('.product-search-button').click(function(){

	$('.product-search-form').toggle();

	return false;

});

$('.product-search-form form').submit(function(){

	$.fn.yiiGridView.update('product-grid', {

		data: $(this).serialize()

	});

	return false;

});

");


?>


<h1>Manage Categories</h1>


<p>

You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>

or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.

</p>


<?php echo CHtml::link('Advanced Search','#',array('class'=>'category-search-button')); ?>

<div class="category-search-form" style="display:none">

<?php   $this->renderPartial('/category/_search',array(

  	'model'=>$categoryModel,

));  ?>

</div><!-- search-form -->


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

	'id'=>'category-grid',

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

        'cssFile'=> Yii::app()->request->baseUrl.'/merged/gridview.css',

	'filter'=>$categoryModel,

	'columns'=>array(

		'id',

		'name',

		'parent_id',

		/*

                'created_at',

		'created_by',

		'modified_at',

		'modified_by',

		*/

		array(

			'class'=>'CButtonColumn',

		),

	),

)); ?>




<hr />


<h1>Manage Products</h1>


<p>

You may optionally enter a comparison operator (<b>&lt;</b>, <b>&lt;=</b>, <b>&gt;</b>, <b>&gt;=</b>, <b>&lt;&gt;</b>

or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.

</p>


<?php echo CHtml::link('Advanced Search','#',array('class'=>'product-search-button')); ?>

<div class="product-search-form" style="display:none">

<?php $this->renderPartial('_search',array(

	'model'=>$model,

)); ?>

</div><!-- search-form -->


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

	'id'=>'product-grid',

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

	'filter'=>$model,

        'cssFile'=>Yii::app()->request->baseUrl.'/merged/gridview.css',

	'columns'=>array(

		'id',

		'system_number',

		'name',

		'price',

		'available',

		'weight',

		/*

		'description',

		'imagePath',

		'stock',

		'category_id',

		'created_at',

		'created_by',

		'modified_at',

		'modified_by',

		*/

		array(

			'class'=>'CButtonColumn',

		),

	),

)); ?>



Filtering and other stuff is working fine, the problem is with url of view ,update, delete , it keeps sending request to product/update/id/2 , whereas i want it to go to category/update/id/2

how can i do that , any suggestions ? ?

Thanks

Rasikh Mashhadi

after reading documentation i figured out the way , for those who are having problem like this ,

read this http://www.yiiframework.com/wiki/106/using-cbuttoncolumn-to-customize-buttons-in-cgridview/