如何在CListView的寻呼机上启用ajaxLink?

时间:2012-05-08 05:17:07

标签: ajax pagination yii

当使用Yii时,我在ajaxUpdate中看到CGridView上的分页。这非常有用。现在,我需要将它合并到CListView中。但我不知道ajaxUpdate的设置是什么。

以下是controller code

$dataProvider = new CActiveDataProvider('Match',array(
    'criteria'=>array(
        'condition' => 'group_id = :groupId',
        'params'    => array(':groupId'=>$groupId),
        'order'=>'date DESC',
    ),
    'pagination'=>array(
        'pageSize'=>3,
    ),
));
$this->renderPartial($view = "_matchsOfGroup", array(
    'dataProvider' => $dataProvider
));

以下是我的view code _matchsOfGroup

<div class="lobbyMain">
    <?php
        $this->widget('zii.widgets.CListView', array(
            'dataProvider'=>$dataProvider,
            'ajaxUpdate'=>true,
            'template'=>'{items}{pager}',
            'itemView'=>'_match',
            'pager'=>array(
                'header'        => '',
                'maxButtonCount'=> '3',                    
            ),            
        ));
    ?>
</div>

_match部分

<table>
    <thead>
    <th>date</th>
    <th>Player</th>
    <th>stack</th>
    </thead>
    <?php foreach($data->matchResults as $result) : ?>
        <tr>
            <td><?php echo $data->date; ?></td>
            <td><?php echo $result->user->username; ?></td>
            <td><?php echo $result->total_stack; ?></td>
        </tr>
    <?php endforeach; ?>
</table>

如何在zii.widgets.CListView中配置'pager'=&gt; array()以使用ajax链接请求

1 个答案:

答案 0 :(得分:0)

$this->renderPartial($view = "_matchsOfGroup", array(
'dataProvider' => $dataProvider));

更改为

 $this->renderPartial($view = "_matchsOfGroup", array(
'dataProvider' => $dataProvider),false, true);