Hi, everybody.
I try to get pagination in my CGridView. Pagination works ok but it doesn’t have ajax.
When i try it in other project, it’s ok.
i recognize that the url of pagination button doesn’t have parameter ajax.
my pagination is: /baongan/transaction/index?NhatKi_page=2 (and it’s GET request)
other is: /demo/department/admin?ajax=department-grid&Department_page=2 (and it’s POST request)
and i also can’t use ajax with dropdownlist.
how can i fix it? (something wrong with my project or config)
help me, please. (sorry about my bad english)
my controller:
public function actionIndex()
{
$model = new NhatKi('search');
$this->render('index',array('model'=>$model));
}
my view:
<?php
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'nhat-ki-grid',
'dataProvider'=>$model->search(),
'ajaxUpdate'=>true,
//'filter'=>$model,
'columns'=>array(
'maGD',
'ngayGD',
'gioGD',
'maLoaiGD0.tenLoaiGD',
'idDT0.tenDoiTac',
'soTien',
'maTT0.tenTT',
),
)); ?>
my model:
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('idNK',$this->idNK);
$criteria->compare('maGD',$this->maGD);
$criteria->compare('maTT',$this->maTT);
$criteria->compare('maTK',$this->maTK);
$criteria->compare('maLoaiGD',$this->maLoaiGD);
$criteria->compare('soTien',$this->soTien);
$criteria->compare('ngayGD',$this->ngayGD,true);
$criteria->compare('gioGD',$this->gioGD,true);
$criteria->compare('idDT',$this->idDT);
$criteria->compare('soNgayTamGiu',$this->soNgayTamGiu);
$criteria->compare('diaChiNhanHang',$this->diaChiNhanHang,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
'pagination'=>array(
'pageSize'=> 10,
),
));
}