i am using the cgridview widget to display some data and using pagination too. but the problem i am have is i need to replace the pagination div. i need to place it on the footer of page like
<div id="footer">
<div id="pagination">
<!-- pagination: << < 1 2 3 4 > >> -->
</div>
</div>
but when i check the html code the pagination div is automatically created by the widget, some div like
<div class="pager">
<!-- pagination: << < 1 2 3 4 > >> -->
</div>
is any solution to do like this...
thanks in advance..
EDITED : as per LDG's post my code is
$pageSize = Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']);
$widget = $this->widget('zii.widgets.grid.CGridView', array(
'id' => 'request-grid',
'dataProvider' => $model->search(),
'cssFile' => Yii::app()->baseUrl . '/media/css/gridview.css',
'summaryText' => '',
'enablePagination' => true,
'template'=>'{items}',
'pagerCssClass'=>'pager',
'pager' => 1,
'pager' => array(
'cssFile' => Yii::app()->baseUrl . '/media/css/gridview.css',
'header' => false,
'firstPageLabel' => 'First',
'prevPageLabel' => 'Previous',
'nextPageLabel' => 'Next',
'lastPageLabel' => 'Last',
),
'columns' => array(
array(
'name' => 'id',
'header' => '#',
'value' => '$this->grid->dataProvider->pagination->currentPage * $this->grid->dataProvider->pagination->pageSize + ($row+1)',
),
........................................
));
?>
<div id="grid-view-footer">
<div class="paginationholder">
<div id="pagination">
<div class="floatright">
<div class="pagers">
<?php $widget->renderPager(); ?>
</div>
</div>
</div>
</div>
<div class="recordspageholder">
<div class="recordsperpage">Records per page
<?php //echo $this->pagination; ?>
<?php echo CHtml::dropDownList('pageSize', $pageSize, array(1 => 1, 20 => 20, 30 => 30, 40 => 40, 50 => 50, 100 => 100), array('onchange' => "$.fn.yiiGridView.update('request-grid',{ data:{pageSize: $(this).val() }})",)); ?>
</div>
</div>
comment on ldg :but a small problem. i use a drop down box to show records per page. CHtml::dropDownList('pageSize', $pageSize, array(1 => 1, 20 => 20, 30 => 30, 40 => 40, 50 => 50, 100 => 100), array('onchange' => "$.fn.yiiGridView.update('request-grid',{ data:{pageSize: $(this).val() }})",));. but when i change the records per page the pagination is not get updated. like if i have 20 records in db, when i select 40 records per page the pagination part is also rendering. is any solution for that. i will updated the code in my question please review it. thanks..
If you don't need to change the mark-up, you don't need to extend any classes. (And if you do want to change how the pager looks, you can do most of that in CSS.)
define your widget with a variable something like this:
$widget = $this->widget(
...
'template'=>'{sorter}{items}'
...
);
(change the template attribute to whatever works best for you.)
then you can call:
$widget->renderPager();
elsewhere in your view.