在我的项目中,我在一个模式窗口中使用了cgridview。现在我面临的问题是,当我选择分页时,页面会重新加载。如何使用ajax分页加载网格视图。下面给出了我的ui代码id ...
<div id="pick-category-modal" title="Pick Category" class="popupinfoholder2">
<div style="width:700px; height:auto;">
<?php
$widget = $this->widget('zii.widgets.grid.CGridView', array(
'id' => 'response-grid',
'dataProvider' => $pickdataset->pickSection(),
'cssFile' => Yii::app()->baseUrl . '/media/css/gridview.css',
'summaryText' => '',
'ajaxUpdate'=>true,
'enablePagination' => true,
'template' => '{items}',
'pager' => array(
'class' => 'LinkPager',
'cssFile' => false,
'header' => false,
'firstPageLabel' => 'First',
'prevPageLabel' => 'Previous',
'nextPageLabel' => 'Next',
'lastPageLabel' => 'Last',
),
'columns' => array(
.....................
.....................
),));
?>
<div class="grid-view-footer">
<div class="paginationholder">
<div id="pagination">
<?php $widget->renderPager(); ?>
</div>
</div>
</div>
</div>
</div>发布于 2011-10-26 02:48:48
刚才我自己测试了一下,看起来用renderPager()踢出的寻呼机在AJAX设置下不工作。CGridView JavaScript只将AJAX绑定到小部件呈现的<div>内的寻呼机(这里是#response-grid),所以它不会找到和使用额外的寻呼机。
我只使用CGridView在底部呈现的默认分页程序,它工作得很好。
您可以覆盖Yii JS来修复这个问题,或者将其作为Yii bug跟踪器上的一个增强列出:http://code.google.com/p/yii/issues/list
https://stackoverflow.com/questions/7886342
复制相似问题