Bonjour à tous,

Depuis quelques jours j'essaye d'utiliser la pagination ajax de cakephp, j'ai suivi les explications de la doc officiel. Le problème est que j'ai une erreur lorsque j'utilise le paginator :
Call to undefined method PaginatorComponent::options()
Je vois bien que le problème viens du "options" mais pourtant c'est ce qui est utilisé dans la doc officiel. La pagination classique fonctionne très bien par contre.

Voici le code de la méthode utilisé dans mon controller :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
public function users()
    {
        $this->set('title_for_layout', "Gestion des utilisateurs");
        $this->set('titre', "Gestion des utilisateurs");
        $this->set('sous_titre', "liste");
        $this->loadModel('User'); 
 
        $this->Paginator->options(array(
        'update' => '#content',
        'evalScripts' => true
        ));
 
        $this->paginate = array(
        'limit' => 5,
        'order' => array(
            'User.created' => 'asc'
        )
        );
        $data = $this->Paginator->paginate('User');
        $this->set('users', $data);
 
        $this->loadModel('Post'); 
        //print_r($this->Post->find('count', array('conditions' => array('Post.user_id' => 'User.id'))));
        //$this->set('nb_article', $this->Post->find('count', array('conditions' => array('Post.'))))
    }
Voici celui de ma vue :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?php
	$this->start('titre');
	echo 'Gestion d\'utilisateurs';
	$this->end();
 
	$this->start('sous_titre');
	echo 'Liste';
	$this->end();
 
	$this->start('ariane');
	echo 'Gestion d\'utilisateurs';
	$this->end();
?>
 
<div class="row">
                        <div class="col-xs-12">
                            <div class="box">
                                <div class="box-header">
                                    <h3 class="box-title">Utilisateurs</h3>
                                    <div class="box-tools">
                                        <div class="input-group">
                                            <input type="text" name="table_search" class="form-control input-sm pull-right" style="width: 150px;" placeholder="Search"/>
                                            <div class="input-group-btn">
                                                <button class="btn btn-sm btn-default"><i class="fa fa-search"></i></button>
                                            </div>
                                        </div>
                                    </div>
                                </div><!-- /.box-header -->
                                <div class="box-body table-responsive no-padding">
                                    <table class="table table-hover" id="content">
                                        <tr>
                                            <th><?php echo $this->Paginator->sort('role','Rôle'); ?></th>
                                            <th><?php echo $this->Paginator->sort('username','Nom'); ?></th>
                                            <th><?php echo $this->Paginator->sort('created','Création'); ?></th>
                                            <th>Status</th>
                                            <th>Nombre d'article</th>
                                        </tr>
                                        <?php foreach($users as $user): ?>
                                        <tr>
                                        <?php if ($user['User']['role']=='admin'): ?>
                                        		<td><span class="label label-success"><?php echo $user['User']['role']; ?></span></td>
                                        <?php elseif($user['User']['role']=='auteur'): ?>
                                        		<td><span class="label label-primary"><?php echo $user['User']['role']; ?></span></td>
                                        <?php else: ?>
                                        		<td><?php echo $user['User']['role']; ?></td>
                                        <?php endif; ?>
 
                                            <td><?php echo $user['User']['username']; ?></td>
                                            <td><?php echo $user['User']['created']; ?></td>
                                            <td><span class="label label-success">Approved</span></td>
                                            <td>Bacon ipsum dolor sit amet salami venison chicken flank fatback doner.</td>
                                        </tr>
                                    <?php endforeach; ?>
                                    </table>
                                </div><!-- /.box-body -->
                                <div class="box-footer clearfix">
                                    <ul class="pagination pagination-sm no-margin pull-right">
                                        <?php
			                            echo $this->Paginator->prev(__('prev'), array('tag' => 'li'), null, array('tag' => 'li','class' => 'disabled','disabledTag' => 'a'));
			                            echo $this->Paginator->numbers(array('separator' => '','currentTag' => 'a', 'currentClass' => 'active','tag' => 'li','first' => 1));
			                            echo $this->Paginator->next(__('next'), array('tag' => 'li','currentClass' => 'disabled'), null, array('tag' => 'li','class' => 'disabled','disabledTag' => 'a'));
			                        ?>
                                    </ul>
                                </div>
                            </div><!-- /.box -->
                        </div>
</div>
<?echo $this->Js->writeBuffer();?>
J'ai pourtant bien déclaré les components RequestHanlder et Paginator sans oublier d'ajouter le helper Js le tout dans AppController. Ca me bloque vraiment dans le développement...

Voici un morceau de code mon AppController :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
class AppController extends Controller {
         public $components = array('DebugKit.Toolbar', 'Paginator','RequestHandler','Session',
	    'Auth' => array(
	        'loginRedirect' => array('controller' => 'posts', 'action' => 'index'),
	        'logoutRedirect' => array('controller' => 'pages', 'action' => 'display', 'home'),
	        'unauthorizedRedirect' => array('controller' => 'posts', 'action' => 'index'),
	        'flash' => array('element' => 'flash_danger', 'key' => 'auth', 'params' => array()),
	        'authorize' => array('Controller') // Ligne ajoutée
	    )
	);
         public $helpers = array('BsHelpers.Bs', 'BsHelpers.BsForm', 'Tinymce', 'Js');
Je vous remercie par avance de l'aide que vous m'apporterez, bien amicalement.