Cake's ajax pagination produces code similar to the following:
$("#link-1983047312").bind("click", function (event) {$.ajax({dataType:"html", evalScripts:true, success:function (data, textStatus) {$("#tableWrap").html(data);}, url:"\/companies\/index\/page: 1"});
Because Cake is using .bind(), after the first ajax request the new ajax content doesn't have those events bind to it. And so, when I click on one of the pagination links for the second time, I get a page refresh.
I tried looking up for a neat solution and the only one I found is to include $this->Js->writeBuffer() and the bottom of my ajax.ctp layout file. That will fix it, no problem, but it will cause problems as every time new ajax content arrives to the browser, it comes with that whole JavaScript code again, and again.
The simplest way to solve it would be to make Cake use .live() rather than .bind(). Is there a way to do that without changing any of Cake's core files?
Thanks!
-- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions.
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
No comments:
Post a Comment