Yii CGridView呈现一个新页面,而不是AJAX


Yii CGridView renders a new page instead of AJAX

在我的网站的索引页,我有浮动div块与CGridView里面。

我需要使用排序,筛选,分页等选项,但只能通过更新这个div,而不是刷新整个页面。

数据渲染,因为它应该,我只坚持更新网格内容-所有的<a>有href,发送用户到指定的视图。

这是grid的视图:(这是我的views.users.usersGrid.php的唯一内容)

$this->widget('zii.widgets.grid.CGridView', array(
    'dataProvider' => $model->search(),
    'filter' => $model,
    'ajaxUrl' => 'modules/subcntrl/usersGrid',
    'ajaxUpdate' => 'users-grid',
    'columns' => array(
        array(
            'name' => 'name',
            'type' => 'raw',
            'value' => 'CHtml::encode($data->name)'
        ),
        array(
            'class'=>'CButtonColumn',
        ),
    ),
));

从views.users.users.php: <?php $this->actionUsersGrid(); ?>

控制器:

public function actionUsers() {
    $this->renderPartial('users');
}
public function actionUsersGrid() {
    if(!Yii::app()->request->isAjaxRequest) die('Url should be requested via ajax only');
    $model = new Users();
    $this->renderPartial('usersGrid',array(
        'model' => $model,
    ));
}

感谢您的帮助

请像这样使用renderPartial方法中的第三和第四个参数,

$this->renderPartial('users',array(),false,true);

它将解决您的问题(设置processOutput=true)在第四个参数

请像这样使用renderPartial方法中的第三和第四个参数,

$this->renderPartial('users',array(),false,true);

它将解决您的问题(设置processOutput=true)在第四个参数

这在我的代码中不起作用。我在ma控制器

中这样使用
$this->renderPartial('_searchQuote', array('model' => $model, 'month' => $month, 'user' => $user), false, $processOutput=false );