I am using cakephp 2.2.2 and I want to create a simple ajax pagination. I am following this ( http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#ajax-pagination ) and I cant seem to get it working right. When I load the page sometimes it uses ajax sometimes it doesnt, in IE 10 I also get something strange like the whole menu collapsing into div that was set to be updated.
Here is what I did:
- Put
echo $this->Html->script('jquery');
inside the<head>
of my layout file. - Included RequestHandler component and Js helper in my controller.
put this in the beginning of my view file:
$this->Paginator->options(array( 'update' => '#content', 'evalScripts' => true ));
put this in the bottom of layout file just before
</body>
:echo $this->Js->writeBuffer();
Then i normally used paginator like this:
echo $this->Paginator->sort('id');
Can somebody tell me if I am missing something or what is wrong because I really can't figure out what I'm doing wrong. Thanks very much.