I set up some Ajax Pagination for sorting records. It’s actually working as expected with the exception that:
1. On fresh page load: Click and sort column displays indicator and sorts as expected.
2. Sort again, and its processed as a standard http request. Results are sorted, but not by Ajax.
3. Sort a 3rd time, and the Ajax is back working and sorts as expected.
It’s back and forth every other time Ajax, http, Ajax, http…
I cannot find out why it seems to be resetting every other sort click.
birds_controller.php
function index() {
$birds = $this->paginate('Bird');
$this->set(compact('birds', $birds));
}
index.ctp
<?php
$this->Paginator->options(array(
'update' => '#birdTable',
'before' => $this->Js->get('#busy-indicator')->effect('fadeIn', array('buffer' => false)),
'complete' => $this->Js->get('#busy-indicator')->effect('fadeOut', array('buffer' => false)),
));
echo $this->Html->image('indicator.gif', array('id' => 'busy-indicator', 'style' => ' display: none;'));
?>
<div id="birdTable">
...
I solved this, BUT I don’t like this solution. It’s on the lines of what I originally suspected. The buffer was not calling the correct data, and so I added:
to the index.ctp and now it works as expected. So I have a copy of the buffer still in my default as well for other scripts…
Does not seem right, but at least it works now.