CakePHP 1.3使用JQuery幫助程序進行Ajax分頁

[英]CakePHP 1.3 Ajax pagination using JQuery helper


I am building a cake application using cake 1.3 and JS helper using JQuery. I followed the ajax pagination tutorial properly from cake's 1.3 tutorial however there is some issue. First page loads fine and when I click on pagination links, action is performed using Ajax however the next page is empty and then no other pagination link works (nothing happens on click). I guess it's a pagination chaining issue however I am following the steps needed to chain the pages properly as mentioned in above tutorial.

我正在使用Cake 1.3和JS助手使用JQuery構建一個蛋糕應用程序。我從cake 1.3的教程中正確地遵循了ajax分頁教程,但是存在一些問題。第一頁加載正常,當我點擊分頁鏈接時,使用Ajax執行操作,但是下一頁是空的,然后沒有其他分頁鏈接工作(單擊時沒有任何反應)。我想這是一個分頁鏈接問題,但我正在按照上面教程中提到的正確鏈接頁面所需的步驟。

One difference in my case is that I am not using the layout div's ID, instead I am using a div from view inside which I am looping through the data. This div contains the paginator options and pagination links so I guess it shouldn't be an issue.

在我的情況下的一個區別是我沒有使用布局div的ID,而是我在視圖中使用div我在其中循環數據。這個div包含paginator選項和分頁鏈接,所以我想這應該不是問題。

1 个解决方案

#1


1  

On the page you linked, there's a section that reads:

在您鏈接的頁面上,有一節內容如下:

You then create all the links as needed for your pagination features. Since the JsHelper automatically buffers all generated script content to reduce the number of tags in your source code you must call write the buffer out. At the bottom of your view file. Be sure to include:

然后,根據分頁功能的需要創建所有鏈接。由於JsHelper會自動緩沖所有生成的腳本內容以減少源代碼中的標記數量,因此必須調用寫入緩沖區。在視圖文件的底部。一定要包括:

echo $this->Js->writeBuffer();

echo $ this-> Js-> writeBuffer();

If you omit this you will not be able to chain ajax pagination links. When you write the buffer, it is also cleared, so you don't have worry about the same Javascript being output twice.

如果省略此項,您將無法鏈接ajax分頁鏈接。當您編寫緩沖區時,它也會被清除,因此您不必擔心輸出兩次相同的Javascript。

This matches your symptoms pretty closely; did you remember to follow this step?

這非常接近你的症狀;你還記得按照這一步嗎?


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:https://www.itdaan.com/blog/2010/12/07/7500a662e01397947badcf52ab6aca12.html



 
  © 2014-2022 ITdaan.com