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.


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:


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.


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




  © 2014-2022 联系我们: