voila j'ai suivi ce tutoriel https://github.com/jeremyharris/multi_select mais ca marche pas sachant que j travail avec cakephp 2.3 php5.2.8 => la suppression ne marche plus, pas de message d'erreur .
quelqu'un peut m'aider s'il vous plait ?!
//dans mon appcontroller
public $components = array('MultiSelect.MultiSelect');
public $helpers = array('MultiSelect.MultiSelect');
//voila la fonction delete dans mon Articlescontroller:
public function deleteAll() {
$selected = $this->MultiSelect->getSelected();
// $selected is an array of ids that were checked
foreach ($selected as $deleteMe) {
$this->Article->delete($deleteMe);
}
$this->Session->setFlash(count($selected).' Articles deleted.');
$this->redirect(array('action' => 'index'));
}
et voila mon code index.ctp:
//le botton delete selected
<?= $this->form->Postlink('Delete selected', array('action' => 'deleteAll', 'mstoken' => $this->MultiSelect->token)); ?>
//ma table
<?= $this->MultiSelect->create(); ?>
<div class="table-responsive">
<table class="table table-bordered table-hover table-striped tablesorter">
<thead>
<tr>
<th></th>
<th><i class="fa fa-sort"><?= $this->paginator->sort('lib_art','Nom d\'Article');?> </i></th>
<th><i class="fa fa-sort"><?= $this->paginator->sort('desc_art','discreption');?> </i></th>
<th><i class="fa fa-sort"><?= $this->paginator->sort('prix_art','Prix d\'achat');?> </i></th>
<th><i class="fa fa-sort"><?= $this->paginator->sort('created','Date de Création');?> </i></th>
<th><i class="fa fa-sort"><?= $this->paginator->sort('updated','Date de Modification ');?> </i></th>
</tr>
</thead>
<tbody>
<?php foreach($Articles as $k => $Article): ?>
<tr >
<td><?= $this->MultiSelect->checkbox($Article['Article']['id']); ?></td>
<td><?= $this->Html->link($Article['Article']['lib_art'],array('action' => 'view',$Article['Article']['id'])) ; ?> </td>
<td><?= $Article['Article']['disc_art']; ?></td>
<td><?= $Article['Article']['prix_art']; ?></td>
<td><?= $Article['Article']['created']; ?></td>
<td><?= $Article['Article']['updated']; ?></td>
<td><?= $this->Html->image("Modify.ico",array(
"alt" => "Brownies",
"title" => __('Modifier'),
'url' => array('action' => 'edit',$Article['Article']['id'])));?></td>
<td><?= $this->form->Postlink($this->html->image('erase.ico',
array("alt" => __('Delete'), "title" => __('Supprimer'))),
array('action' => 'delete', $Article['Article']['id']),
array('escape' => false, 'confirm' => __('Are you sure?'))
); ?></td>
</tr>
<?php Endforeach ?>
</tbody>
</table>
</div>
<?= $this->MultiSelect->end(); ?>
</div>
mErciii^^