Problem With Nested Whgridview


I’m a newbie in Yii programming.

I’m using boostrap library on Yii via Yiistrap/Yiiwheels

I’ve created a relation table view

The related view is a Whgridview itself

The first (master grid) has a TbRelationColum clicking it i display the second grid (detail grid).

When I click on the row to display the sub grid, everything appears ok. When I change the sort order or the page of the sub grid disappear both grid.

I understand we should differentiate the css class of the pager and the sort of sub grid from the main grid. How to do this specifically in Yii-Way?

Is This the problem?

This is the view of the main grid:





        'template' => "{summary}{items}<div class=\"row-fluid\"><div class=\"pull-right\">{pager}</div></div>",

        'type' => array(TbHtml::GRID_TYPE_BORDERED, TbHtml::GRID_TYPE_STRIPED),   



                    'class' => 'yiiwheels.widgets.grid.WhRelationalColumn',

                    //'name' => '',

                    'type' => 'raw',

                    'header' => 'Sub Items',

                    'url' => $this->createUrl('multiGroup/ajaxSubItems'),

                    'cacheData' => false,

                    'value' => "CHtml::tag('button',array('class'=>'btn btn-primary'),'Sub Items')",


                    'cssClass' => 'showSubItems',









This is the sub-grid:

    echo CHtml::tag('h3',array(),'Sub Items Group #"'.$id.'"');

    $this->widget('yiiwheels.widgets.grid.WhGridView', array(


        'type'=>array(TbHtml::GRID_TYPE_BORDERED, TbHtml::GRID_TYPE_STRIPED),

        'dataProvider' => $gridDataProvider,

        'template' => "{summary}{items}<div class=\"row-fluid\"><div class=\"pull-right\">{pager}</div></div>",

        'columns' => $gridColumns,


This is the controller:


	 * Manages all models.


	public function actionAdmin()


		$model=new MultiGroup('search');

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

		if (isset($_GET['MultiGroup'])) {







	public function actionAjaxSubItems()


            $id = Yii::app()->getRequest()->getParam('id');

            $model = $this->loadModel($id);

            if($model->numSubItems > 0) {

                $this->renderPartial('_child', array('id' => $id, 

                                                     'gridDataProvider' => $this->getGridDataProvider($id),

                                                     'gridColumns' => $this->getGridColumns()

                                                ), false, true);

            } else {

                echo 'Non ci sono Sub Items.';




        public function getGridDataProvider($id) {


            $sql = 'SELECT * FROM multi_member WHERE groupid = :groupid ORDER BY lastname,firstname';

            $cmd = Yii::app()->db->createCommand($sql);

            $cmd->bindParam(':groupid', $id, PDO::PARAM_INT);

            $result = $cmd->queryAll();


            $dataProvider = new CArrayDataProvider(

                        $result, array(

                            'sort' => array(

                                'attributes' => array('id','groupid','firstname','lastname','membersince'),

                                'defaultOrder' => array('lastname' => CSort::SORT_ASC, 'firstname' => CSort::SORT_ASC),


                            'pagination' => array(

                                'pageSize' => 2,




            return $dataProvider;




        public function getGridColumns() {


            return array('id', 'lastname', 'firstname', 'membersince');


How can I do?

thank you …