jquery - CakePHP store parameters to the paginator settings -
i have function filters paginator this:
    public function indextipo() {     $this->cabasiento->recursive = 0;     $tipo = $this->request->data['tipo'];            $fecha = $this->request->data['fecha_desde'];     $this->paginator->settings=array(         'paramtype' => 'querystring',                         'limit'=> 1,          'conditions' => array('cabasiento.tipo_doc' => $tipo, 'month(cabasiento.fecha)' => $fecha),          'order' => array('cabasiento.id_numero' => 'asc')     );     $this->set('cabasientos', $this->paginator->paginate());     $this->layout = 'ingresos';          }   it have .ctp.
it works , display filter data, when try next other page gives me:
undefined index: tipo [app\controller\cabasientoscontroller.php, line 35]
undefined index: fecha_desde [app\controller\cabasientoscontroller.php, line 36]
cause parameters lost. how can keep or store thos parameters sends form search:
            <div class="portlet-body">             <?php echo $this->form->create(false, array('action' => 'indextipo','id' => 'form-login1')); ?>              <fieldset>             <?php                 echo $this->form->input('fecha_desde', array('id'=>'fecha_desde1', 'type' => 'date','dateformat' => 'm','class' => 'span3'));                 $arrcategory=array("ing"=>"ingreso","egre"=>"egreso","trasp"=>"trapaso");                 echo $this->form->input('tipo',array('type' => 'select','options'=> $arrcategory));              ?>             </fieldset>         </div>         </div>         </div>     </div>     </div>     <div class="modal-footer">         <?php              echo $this->form->button("<i class='icon-plus'></i> buscar", array('type' => 'submit','id' => 'submit_id', 'class' => 'btn green', 'escape' => false, 'aria-hidden'=>"true"));             echo $this->form->end();         ?>           </div>      
i think looking can setup using search plugin.
your controller should like:
class articlescontroller extends appcontroller {      public $components = array(         'search.prg'     );      public function find() {         $this->prg->commonprocess();         $this->paginator->settings['conditions'] = $this->article->parsecriteria($this->prg->parsedparams());         $this->set('articles', $this->paginator->paginate());     } }      
Comments
Post a Comment