title: TbPager Yii Yiibooster
body: <p>I am using Yiibooster, the ExtendedGridView and TbPager. After filtering, the results are not displayed on page. For example I have a total count of 5 results, the first 2 results are on the page 1 and the other 3 are on the second page of the grid.</p>
  
  <p>Thanks</p>
  
  <p>EDIT:</p>
  
  <p>Model:</p>
  
  <pre><code> public function search() {
      $criteria = new CDbCriteria;
      $criteria-&gt;together = true;
      $criteria-&gt;with = array('training','instructor','room','contactdetails','status');
  
      $criteria-&gt;compare('id', $this-&gt;id);
      $criteria-&gt;compare('trainingid', $this-&gt;trainingid);
      $criteria-&gt;compare('categoryid',$this-&gt;categoryid);
      $criteria-&gt;compare('roomid', $this-&gt;roomid);
      $criteria-&gt;compare('instructorid', $this-&gt;instructorid);
      $criteria-&gt;compare('statusid', $this-&gt;statusid);
      $criteria-&gt;compare('termin', $this-&gt;termin);
      $criteria-&gt;compare('duration', $this-&gt;duration);
      $criteria-&gt;compare('maxparticipants', $this-&gt;maxparticipants);
      $criteria-&gt;compare('comment', $this-&gt;comment);
      $criteria-&gt;compare('contactdetailid', $this-&gt;instructorid);
  
      if (!empty($this-&gt;from_date) &amp;&amp; empty($this-&gt;to_date)) {
         $criteria-&gt;condition = "termin &gt;= '$this-&gt;from_date'"; 
      } elseif (!empty($this-&gt;to_date) &amp;&amp; empty($this-&gt;from_date)) {
         $criteria-&gt;condition = "termin &lt;= '$this-&gt;to_date'";
      } elseif (!empty($this-&gt;to_date) &amp;&amp; !empty($this-&gt;from_date)) {         
         $criteria-&gt;condition = "termin  &gt;= '$this-&gt;from_date' and              termin&lt;='$this-&gt;to_date'";        
      }
  
  
      return new CActiveDataProvider($this, array(
          'criteria' =&gt; $criteria,
          'sort'=&gt;array(
          'defaultOrder'=&gt;array(
                       'termin ASC',
                      )
      ),
          'pagination' =&gt; array(
              'pageSize' =&gt; 15),
  
      ));
  
  }
  </code></pre>
  
  <p>View:</p>
  
  <pre><code>  $this-&gt;widget('bootstrap.widgets.TbExtendedGridView', array(
          'type' =&gt; 'striped bordered',
          'dataProvider' =&gt; $model-&gt;search(),
          'afterAjaxUpdate' =&gt; 'reinstallDatePicker',
          'enablePagination'=&gt;true,
          'summaryText'=&gt;'{count} Ergebnisse',
          'template' =&gt; "{summary}{items}\n{pager}",
          'filter' =&gt; $model,
          'pager' =&gt; array(
                  'class' =&gt; 'bootstrap.widgets.TbPager'),
          'columns' =&gt;  array(  
                  array(
                    'type' =&gt; 'raw',
                    'value' =&gt; 'Seminar::getStatusIcon($data-&gt;id)',
                    'header' =&gt; 'Status',
                    'htmlOptions' =&gt; array('width' =&gt; '20px')),
                 array(
                    'type' =&gt; 'raw',
                    'value' =&gt; 'Seminar::getMyBookingStatus($data-&gt;id)',
                    'header' =&gt; 'Mein Status',
                    'htmlOptions' =&gt; array('width' =&gt; '120px'),
                    'filter' =&gt; CHtml::listData(Bookingstatus::model()-&gt;findAll(), 'id', 'name')),
                 array(
                    'name' =&gt; 'trainingid',
                    'value' =&gt; '$data-&gt;training-&gt;name',
                    'header' =&gt; 'Kurs',
                    'filter' =&gt; CHtml::listData($model-&gt;findAll(array('order' =&gt; 'trainingid ASC')), 'trainingid', 'training.name')),
                array(
                    'name' =&gt; 'categoryid',
                    'value' =&gt; '$data-&gt;training-&gt;category-&gt;name',
                    'header' =&gt; 'Kategorie',
                    'filter' =&gt; CHtml::listData(Tcategory::model()-&gt;findAll(array('order' =&gt; 'name ASC')), 'id', 'name')),       
               array(
                   'name' =&gt; 'termin',
                   'header' =&gt; 'Termin',
                   'filter' =&gt; $this-&gt;widget('zii.widgets.jui.CJuiDatePicker', array(
                   'model' =&gt; $model,
                   'attribute' =&gt; 'termin',
                   'language' =&gt; 'de',
                   'i18nScriptFile' =&gt; 'jquery.ui.datepicker-ja.js',
                   'htmlOptions' =&gt; array(
                   'id' =&gt; 'Projects_confirmStart',
                   'dateFormat' =&gt; 'yy-mm-dd',),
  
                   'options' =&gt; array(
                                'showOn' =&gt; 'focus',
                                'showOtherMonths' =&gt; true,
                                'selectOtherMonths' =&gt; true,
                                'changeMonth' =&gt; true,
                                'changeYear' =&gt; true,
                                'showButtonPanel' =&gt; true,
                                     )
                                ), true),
      ), ........
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>       public function actionIndex() {
  
                 $this-&gt;layout = '//layouts/column1';
  
                 unset(Yii::app()-&gt;request-&gt;cookies['from_date']);  
                 unset(Yii::app()-&gt;request-&gt;cookies['to_date']);
  
                 $model = new Seminar('search');
  
                 $model-&gt;unsetAttributes();  
  
  
                 if(!empty($_POST))
                      {      
                       Yii::app()-&gt;request-&gt;cookies['from_date'] = new CHttpCookie('from_date', $_POST['from_date']);  // define cookie for from_date
                       Yii::app()-&gt;request-&gt;cookies['to_date'] = new CHttpCookie('to_date', $_POST['to_date']);
                       $model-&gt;from_date = $_POST['from_date'];
                       $model-&gt;to_date = $_POST['to_date'];
                      }
  
                  if(isset($_GET['Seminar'])){
  
                       $model-&gt;attributes=$_GET['Seminar'];
  
                     }
  
  
                  $this-&gt;render('index', array(
                        'model' =&gt; $model,        
                   ));
                    }
  </code></pre>