0
我根據官方文檔中實現分頁組件: http://book.cakephp.org/2.0/en/core-libraries/components/pagination.htmlAjax的分頁觸發一次
我還包括Ajax的支持。基本上everthing工作正常,除了一件事情:如果我從頁面1切換到頁面2的ajax請求將工作,之後,我從頁面2切換到3而不是ajax-請求將執行正常的Post-Request。所以ajax只能用一次。
我的控制器看起來像這樣(簡稱):
public $components = array('Paginator', 'RequestHandler');
public $helpers = array('Js', 'Categorie');
....
$this->Paginator->settings = array(
'limit' => '15'
);
沒有更重要的是我的觀點:(jQuery的都包括在我的佈局...)
$this->Js->JqueryEngine->jQueryObject = 'jQuery';
$this->Paginator->options(array(
'update' => '#paginate',
'evalScripts' => true,
'before' => $this->Js->get('#busy-indicator')->effect('fadeIn', array('buffer' => false)),
'complete' => $this->Js->get('#busy-indicator')->effect('fadeOut', array('buffer' => false))
));
?>
<?php
echo $this->Html->image('indicator.gif', array(
'id' => 'busy-indicator'
));
?>
<div id="paginate">...display data...</div>
<?php
echo $this->Paginator->numbers();
echo $this->Paginator->prev('« Previous', null, null, array('class' => 'disabled'));
echo $this->Paginator->next('Next »', null, null, array('class' => 'disabled'));
echo $this->Paginator->counter();
?>
這一切...如前所述:Switch 1-> 2將工作,Switch 2-3會執行正常的POST請求,Switch 3-4將工作,所以一個...
有點奇怪,所以任何想法?順便說一句。我嘗試不同的jQuery版本沒有任何影響(目前我使用2.0.3 ...)
謝謝 - 最好的問候 Teyhouse
您的JS在更新DOM時是否存在或者是更新的DOM的一部分,因此被刪除並重新插入?更新之後,所述元素是否有任何事件關聯? (用'alert(element.onclick)'檢查) 也許你需要設置JQuery事件委託。 – user221931
嗨,感謝您的回覆 - 我幾乎要按自己的意願實現這個洞,但事實證明,我錯過了在文件末尾寫入緩衝區......所以如果有人遇到同樣的問題:Check如果你在你的代碼的底部有這行:<?php echo $ this-> Js-> writeBuffer(); ?> – Teyhouse