Yii Cactivedataprovider Or Tbgridview Do Not Work With Pagination

I’m using Yii Booster TbGridView to show a DataProvider from CActiveDataProvider. It is functioning but not completely. I do not know what is going on with the pagination because when I select the other pages from the Grid, it does not return any record. It is strange because the pagination by default is 10 records, and the data is for example 33 records, the pagination creates 4 pages but I only can see the first 10 records and the others are not shown after I click on the number of the page I want to see. I only can see the first ten records.

Here’s my code: Action (Controller)




public  function    actionIndex()   

            {

                            //Verificamos si es la primera vez que se corre la accion y asignamos fechas iniciales

                            if (!isset($_POST['FormGestionInformacion']['fechaDesde']) && !isset($_POST['FormGestionInformacion']['fechaDesde']) )

                            {


                                            $fechaHasta = date('Y-m-d');

                                            $fechaDesde = date('Y-m-d',time()-(60*60*24*15));//Quince dias atras

                            }

                            else

                            {


                                            $fechaHasta = $_POST['FormGestionInformacion']['fechaHasta'];

                                            $fechaDesde = $_POST['FormGestionInformacion']['fechaDesde'];

                            }


                            //Verificamos si el usuario mando filtro, y armamos el WHERE a ver si esa palabra esta en alguna parte


                            $criteria   =   new CDbCriteria();

                            $criteria->alias    =   's';

                            $criteria->select   =   'c.fecha_creacion, 

                            c.fecha_cierre, 

                            s.caso_sistema_info, 

                            s.sistema_informacion, 

                            s.documentacion,  

                            s.fecha_documentacion,  

                            s.usuario, 

                            s.tipo_documentacion, 

                            s.tipo_protocolo';

                            $criteria->join = "INNER JOIN ".DB_USUARIOS.".soporte_casos c ON  s.caso_sistema_info=c.caso_sistema_info";

                            $criteria->condition = "s.caso_sistema_info=c.caso_sistema_info and fecha_cierre>='".$fechaDesde." 00:00:00' and fecha_cierre<='".$fechaHasta." 23:59:59'";

                            $criteria->group = "s.caso_sistema_info";

                            $criteria->order = " s.caso_sistema_info";

                            $criteria->offset = 0;

                            if (isset($_POST['FormGestionInformacion']['filtro']) && $_POST['FormGestionInformacion']['filtro']!='') 

                            {

                                            $filtro = $_POST['FormGestionInformacion']['filtro'];

                                            $criteria->addCondition ("s.caso_sistema_info like '%$filtro%' 

                                                                                                                         or s.sistema_informacion like '%$filtro%' 

                                                                                                                            or s.usuario like '%$filtro%' 

                                                                                                                            or s.tipo_documentacion like '%$filtro%' 

                                                                                                                            or s.tipo_protocolo LIKE '%$filtro%'

                                                                                                                            ");

                            }

                            $dataProvider   =   new CActiveDataProvider('SoporteCasosDocumentacion',    array(

                                            'criteria'  =>  $criteria,

                                            'pagination' => array( 

                 'pageSize' => 5,

            ),      

                                            )

                            );

                            $model = new FormGestionInformacion ();

                            $this->render('index',  array(

                                            'dataProvider'  =>  $dataProvider,

                                            'model'=> $model,

                                            'fechaDesde'=>$fechaDesde,

                                            'fechaHasta'=>$fechaHasta,

                                            'filtro'=>$filtro,

                                            )

                            );

            }



Model:




class   SoporteCasosDocumentacion   extends CActiveRecord   {


            /**

                * @return string the associated database table name

                */

            public  function    tableName() {

                            return      'soporte_casos_documentacion';

            }


            /**

                * @return array validation rules for model attributes.

                */

            public  function    rules() {

                            // NOTE: you should only define rules for those attributes that

                            // will receive user inputs.

                            return  array(

                                            array('caso_sistema_info, sistema_informacion, usuario',    'required'),

                                            array('fecha_documentacion, caso_sistema_info, sistema_informacion, usuario',   'length',   'max'   =>  45),

                                            array('email, celular', 'length',   'max'   =>  50),

                                            array('informacion_cliente_une',    'length',   'max'   =>  1),

                                            array('archivo_adjunto, pro_det, sol_dad, ubi_fal, causa, ser_afe, con_aut, cor_ele',   'length',   'max'   =>  100),

                                            array('tipo_documentacion, tipo_protocolo, tie_sol, tel_con, cel_con',  'length',   'max'   =>  10),

                                            array('documentacion, error_oci',   'safe'),

                                            // The following rule is used by search().

                                            // @todo Please remove those attributes that should not be searched.

                                            array('id_doc, fecha_documentacion, caso_sistema_info, sistema_informacion, documentacion, email, celular, informacion_cliente_une, usuario, archivo_adjunto, tipo_documentacion, tipo_protocolo, error_oci, pro_det, sol_dad, ubi_fal, causa, ser_afe, tie_sol, con_aut, cor_ele, tel_con, cel_con',   'safe', 'on'    =>  'search'),

                            );

            }


            /**

                * @return array relational rules.

                */

            public  function    relations() {

                            // NOTE: you may need to adjust the relation name and the related

                            // class name for the relations automatically generated below.


                            return  array(

                            );

            }


            /**

                * @return array customized attribute labels (name=>label)

                */

            public  function    attributeLabels()   {

                            return  array(

                                            'id_doc'    =>  'Id Doc',

                                            'fecha_documentacion'   =>  'Fecha Documentacion',

                                            'caso_sistema_info' =>  'Caso Sistema Info',

                                            'sistema_informacion'   =>  'Sistema Informacion',

                                            'documentacion' =>  'Documentacion',

                                            'email' =>  'Email',

                                            'celular'   =>  'Celular',

                                            'informacion_cliente_une'   =>  'Informacion Cliente Une',

                                            'usuario'   =>  'Usuario',

                                            'archivo_adjunto'   =>  'Archivo Adjunto',

                                            'tipo_documentacion'    =>  'Tipo Documentacion',

                                            'tipo_protocolo'    =>  'Tipo Protocolo',

                                            'error_oci' =>  'Error Oci',

                                            'pro_det'   =>  'Pro Det',

                                            'sol_dad'   =>  'Sol Dad',

                                            'ubi_fal'   =>  'Ubi Fal',

                                            'causa' =>  'Causa',

                                            'ser_afe'   =>  'Ser Afe',

                                            'tie_sol'   =>  'Tie Sol',

                                            'con_aut'   =>  'Con Aut',

                                            'cor_ele'   =>  'Cor Ele',

                                            'tel_con'   =>  'Tel Con',

                                            'cel_con'   =>  'Cel Con',

                            );

            }


            /**

                * Retrieves a list of models based on the current search/filter conditions.

                *

                * Typical usecase:

                * - Initialize the model fields with values from filter form.

                * - Execute this method to get CActiveDataProvider instance which will filter

                * models according to data in model fields.

                * - Pass data provider to CGridView, CListView or any similar widget.

                *

                * @return CActiveDataProvider the data provider that can return the models

                * based on the search/filter conditions.

                */

            public  function    search()    {

                            // @todo Please modify the following code to remove attributes that should not be searched.


                            $criteria   =   new CDbCriteria;


                            $criteria->compare('id_doc',    $this->id_doc,  true);

                            $criteria->compare('fecha_documentacion',   $this->fecha_documentacion, true);

                            $criteria->compare('caso_sistema_info', $this->caso_sistema_info,   true);

                            $criteria->compare('sistema_informacion',   $this->sistema_informacion, true);

                            $criteria->compare('documentacion', $this->documentacion,   true);

                            $criteria->compare('email', $this->email,   true);

                            $criteria->compare('celular',   $this->celular, true);

                            $criteria->compare('informacion_cliente_une',   $this->informacion_cliente_une, true);

                            $criteria->compare('usuario',   $this->usuario, true);

                            $criteria->compare('archivo_adjunto',   $this->archivo_adjunto, true);

                            $criteria->compare('tipo_documentacion',    $this->tipo_documentacion,  true);

                            $criteria->compare('tipo_protocolo',    $this->tipo_protocolo,  true);

                            $criteria->compare('error_oci', $this->error_oci,   true);

                            $criteria->compare('pro_det',   $this->pro_det, true);

                            $criteria->compare('sol_dad',   $this->sol_dad, true);

                            $criteria->compare('ubi_fal',   $this->ubi_fal, true);

                            $criteria->compare('causa', $this->causa,   true);

                            $criteria->compare('ser_afe',   $this->ser_afe, true);

                            $criteria->compare('tie_sol',   $this->tie_sol, true);

                            $criteria->compare('con_aut',   $this->con_aut, true);

                            $criteria->compare('cor_ele',   $this->cor_ele, true);

                            $criteria->compare('tel_con',   $this->tel_con, true);

                            $criteria->compare('cel_con',   $this->cel_con, true);


                            return  new CActiveDataProvider($this,  array(

                                            'criteria'  =>  $criteria,

                            ));

            }


            /**

                * @return CDbConnection the database connection used for this class

                */

            public  function    getDbConnection()   {

                            return  Yii::app()->Usuarios;

            }


            /**

                * Returns the static model of the specified AR class.

                * Please note that you should have this exact method in all your CActiveRecord descendants!

                * @param string $className active record class name.

                * @return SoporteCasosDocumentacion the static model class

                */

            public  static  function    model($className    =   __CLASS__)  {

                            return  parent::model($className);

            }



The Widget:




<?php

                            $this->widget('bootstrap.widgets.TbButton', array(

                                            'buttonType'    =>  'button',

                                            'type'  =>  'primary',

                                            'label' =>  'Consultar',

                                            'size'  =>  'large',

                                            'htmlOptions'   =>  array(

                                                            'onClick'   =>  '{ValidacionDatos()}',

                                                            'class' =>  'btn'

                                            ),

                            ));

                            ?>



There are some attached images. They show the response of the ajax call.

Thanks to everyone.

Ok, Thanks to all. I have found the solution.