2
我得到這個觀點CakePHP的搜索分頁問題,失去值到下一個頁面
?php echo $this->Form->create('Search', array('id' => 'Search', 'url' => array('controller' => 'mycontroller', 'action' => 'index'))); ?>
<?php echo $this->Form->input('usuario_id', array('label' => __('Vendedores', true), 'options' => $vendedores, 'empty' => true)); ?>
<?php echo $this->Form->input('cliente_id', array('label' => __('Cliente', true), 'options' => $clientes, 'empty' => true)); ?>
<?php echo $this->Location->estados(); ?>
<?php echo $this->Location->municipios(); ?>
<?php echo $this->Location->bairros(); ?>
<?php echo $this->Form->input('equipe_id', array('label' => __('Equipe', true), 'options' => $equipe, 'empty' => true)); ?>
<?php echo $this->Form->input('veiculo_id', array('label' => __('Modelo', true), 'options' => $veiculos, 'empty' => true)); ?>
<?php echo $this->Form->input('status', array('label' => __('Status', true), 'options' => $status, 'empty' => true,'multiple' => true)); ?>
<?php echo $this->Utils->data('date_from', array('input' => array('label' => 'De'))); ?>
<?php echo $this->Utils->data('date_to', array('input' => array('label' => 'a'))); ?>
<?php echo $this->Form->hidden('Search.search'); ?>
<?php echo $this->Form->end('Buscar'); ?>
和我的控制器paginations條件這樣
if(!empty($this->data['Search']['myvar_id'];)) $this->paginate['conditions']['myModel.myvar_id'] = $this->data['Search']['myvar_id'];
所有搜索字段都做工精細,並在# 1頁,沒關係,但是當我分頁到#2頁面時,值被清除。 正如你所看到的,我在窗體上使用post方法, 所以使用這個場景,我怎麼能確定,當我分頁的值不會丟失?
感謝先進!
這不能解決問題。這些值不會在第一頁中生存。 – CptAJ