Hi folks,
I have a question. I have this script about the a searching with pagination.
Here is the code:
$page_count = 2;
$page_count = 2;
//$criteria = new CDbCriteria;
$total_count = Table::model()->count();
$pages = new CPagination($total_count);
$pages->setPageSize($page_count);
$result = Job::model()->findAll();
$dataProvider = new CArrayDataProvider($result,array('pagination'=>array('pageSize'=>$page_count)));
//print_r($model);
$this->render('index',array(
'object_Model'=>$dataProvider->getData(),
'dataProvider'=>$dataProvider,
'pages'=>$pages,
'itemCount'=>$total_count,
));
A part of the View
<?php $form=$this->beginWidget('CActiveForm', array(
'action'=>Yii::app()->createUrl('job/search/'),
'method'=>'get',
)); ?>
<?php echo CHtml::textField('keyword','',array('class'=>'form-control','placeholder'=>"Keywords",'size'=>60,'maxlength'=>200)); ?>
<?php echo CHtml::textField('country','',array('class'=>'form-control','placeholder'=>"Keywords",'size'=>60,'maxlength'=>200)); ?>
<?php $this->endWidget(); ?>
<?php
// the pagination widget with some options to mess
$this->widget('CLinkPager', array(
'currentPage'=>$pages->getCurrentPage(),
'pages' => $dataProvider->pagination,
'firstPageLabel'=>'First',
'lastPageLabel'=>'Last',
'prevPageLabel'=>'«',
'nextPageLabel'=>'»',
));
?>
So this is the format of the view. Since the form in method="get" so the pass value should be on url. However, the pagination does not automatically pick up by the pagination links?