yiigridview controller in renderpartial

Hi .

When i use renderPartial with a view from a diferent model/controller , yiigridview uses the controller from the main view.


in casa/update

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

            'model' => $model,



and in this update view i use

  <?php echo $this->renderPartial('//reserva/adminAll', array('model' => new Reserva(),

 'cod_casa' => $model->cod_casa, 

'modelCasa' => $model,

'referer'=>'casa')); ?>

and in this view

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



















)); ?>

the problem is that yiigridview call casaController

thanks in advance

You can specify ‘ajaxUrl’ property to the grid in the partial view.


Another proble if i use

'ajaxUrl' =>$this->createUrl('reserva/adminAll',array('cod_casa' => $cod_casa)),

i get url


but need to put cod_casa in querystring

how can i do that?

Led, I’m very sorry that I have made a mistake. :(

I’m a newbie moderator and wrongly “edited” your post when I tried to “reply” to your post. Forgive me please.

Well, do you really need that?

I mean, I don’t think the URL for ajax call has much meaning to the end users.

But anyway if you want ‘code_casa’ to be in the query string, then you have to change your urlManager rules according to your needs.

Probably you have a rule like this in your current configuration:

    '<controller:\w+>/<action:\w+>/*' => '<controller>/<action>',

"/*" at the tail of the pattern is the reason why you get


instead of


You can try replacing the rule with

    '<controller:\w+>/<action:\w+>' => '<controller>/<action>',

But it will also affect the other urls.