Bonjour,
Actuellement j essaye de paginer les données , sans succes.
Je perds mes filtres sur la pages 2, 3 ect .
J utilise cakephp 2
Merci d'avance.
voici mon controlleur :
GenproduitsController
<?php
class GenproduitsController extends AppController {
public $helpers = array('Html', 'Form','Js' => array('Jquery'));
public $components = array('Session');
public function index() {
if(isset($this->data'Genproduit'])){
$nom= $this->data'Genproduit']'Nom_Produit'];
$code=$this->data'Genproduit']'Ref_Constructeur'];
$emplacement=h($this->data'Genproduit']'emplacementrgenpdsuivi']);
$this->paginate = array(
'conditions' => array(
'Genproduit.Ref_Constructeur LIKE'=>'%'.$code.'%',
'Genproduit.Nom_Produit LIKE'=>'%'.$nom.'%',
'Genpdsuivi.Libre2 LIKE'=>'%'.$emplacement.'%'),
'limit'=>50
);
$genproduits=$this->paginate('Genproduit');
$this->set('genproduits',$genproduits);
}
else {
$genproduits=$this->paginate('Genproduit');
}
$this->set('genproduits',$genproduits);
}
}
?>
____________________________________________________________________
Voici ma vue index
<body>
<?php
echo $this->Form->create('Genproduit');
echo $this->Form->input('Ref_Constructeur', array ('label'=>'CODE ARTICLE'));
echo $this->Form->input('Nom_Produit', array ('label'=>'DESIGNATION'));
echo $this->Form->input('emplacementrgenpdsuivi', array ('label'=>'EMPLACEMENT : '));
echo $this->Form->end('RECHERCHER');
?>
<?php
echo $this->Paginator->first('Debut');
echo $this->Paginator->prev('<<' . __(''), array(), null, array('class' => 'prev disabled'));
echo $this->Paginator->numbers();
echo $this->Paginator->next('>>' . __(''), array(), null, array('class' => 'next disabled'));
echo $this->Paginator->last('Fin');
echo '</br>';
echo $this->Paginator->counter();
?>
<table>
<tr>
<th><?php echo $this->Paginator->sort('Ref_Constructeur', 'Code article'); ?></th>
<th><?php echo $this->Paginator->sort('Nom_Produit', 'Désignation'); ?></th>
<th><?php echo $this->Paginator->sort('Libre2', 'Emplacement'); ?></th>
<th><?php echo $this->Paginator->sort('Action', 'Action'); ?></th>
</tr>
<?php foreach ($genproduits as $genproduit): ?>
<tr>
<td><?php echo $genproduit'Genproduit']'Ref_Constructeur']; ?> </td>
<td><?php echo h($genproduit'Genproduit']'Nom_Produit']); ?> </td>
<td><?php echo h($genproduit'Genpdsuivi']'Libre2']); ?> </td>
<td>
<?php
echo $this->Js->submit('IMPRIMER',array('url' => array(
'action' => 'fiche1',$genproduit'Genproduit']'Ref_Constructeur'])));
?>
</td>
</tr>
<?php endforeach; ?>
</table>
<?php echo $this->Js->writeBuffer(); ?>
</body>