I was having the same issue about the ajax pagination occurring every
other page (and I'm using MooTools). The key was that I *was* putting
the call to $js->writeBuffer() in my default.ctp view file in the
'content' div that got updated. However, this file was not seeing the
new content. So, I moved my writeBuffer() call from default.ctp to my
table.ctp (custom) element file and it worked! Yay! Recap...
default.ctp
<div id="content">
<?php echo $content_for_layout; ?>
</div>
...
<?php echo $js->writeBuffer(); ?> // Keep this at the bottom of the
page for the original-loaded content (if there is no table with
pagination)
</body>
table.ctp (custom element) - this file gets read with each ajax
request
<table>
...
</table>
<?php echo $js->writeBuffer(); ?> // Put this call in the view that
gets updated
Hope this helps some people out there because I really haven't seen
any clear explanation elsewhere.
Happy coding,
~Philip
On Dec 16 2009, 3:39 pm, mark_story <[email protected]> wrote:
> Yeah you need the writeBuffer() at the bottom of the view, or in
> yourajaxlayout. Otherwise the event scripts don't get sent along. I'll
> have to look into the jquery issue, I thought jquery did global eval()
> on all the script blocks in an html response, but seems I might have
> been wrong.
>
> -Mark
>
> On Dec 16, 5:27 am, Dave <[email protected]> wrote:
>
> > I have run into issues like this as well. For some reason sometimes when
> > content is pulled in viaajaxI need to call $js->writeBuffer; at the bottom
> > of the view in the action which is called to get all of the javascript to
> > echo properly.
>
> > It kind of makes sense, if you have $js->writeBuffer at the bottom of your
> > layout, and your layout isn't refreshed, then you won't get the javascript
> > from the new view
>
> > I am not sure if this is how it is supposed to work, but that's just what
> > i've noticed
>
> > On Tue, Dec 15, 2009 at 2:21 PM, Joe Theory <[email protected]> wrote:
> > > I am having the same problem and can confirm that it happens
> > > specifically when using JQuery. Using the Js Helper with Mootools
> > > works just fine.
>
> > > On Dec 14, 3:44 am, Scronkey <[email protected]> wrote:
> > > > I believe I know what's going on now but I'm not sure how to fix it.
>
> > > > On the first (successful)ajaxcall the next set of content is loaded,
> > > > including the paginator links, however the paginator links are not
> > > > successfully bound to a jQueryajaxcall, therefore the next click
> > > > results in a normal page request which then results in correctly bound
> > > > events.
>
> > > > Marks post mentions the use of 'evalScripts' => true to chain theajax
> > > > requests however this seems to have no effect with jQuery (his example
> > > > uses MooTools).
>
> > > > Is there a way I can ensure the events are rebound using jsHelper with
> > > > jQuery after theajaxcall?
>
> > > Check out the new CakePHP Questions sitehttp://cakeqs.organdhelp others
> > > with their CakePHP related questions.
>
> > > You received this message because you are subscribed to the Google Groups
> > > "CakePHP" group.
> > > To post to this group, send email to [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]<cake-php%[email protected]
> > > om>For more options, visit this group at
> > >http://groups.google.com/group/cake-php?hl=en
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en