Re: ajax pagination

2016-01-07 Thread euromark
See http://sandbox3.dereuromark.de/sandbox/ajax-examples

Mark


Am Dienstag, 5. Januar 2016 10:21:29 UTC+1 schrieb Kamlesh Gupta:
>
> Hello,
>
> I am facing a problem of pagination in cakephp 3.14..
>
> How can we make a ajax pagination in cakephp 3.1.4
>
> would anyone please help me.
>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at https://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: Ajax Pagination with Filter Plugin Problem

2013-06-07 Thread Yorick Horrie
Hi,

Don't know if you found this allready, but for those who are reading this 
and have the same problem.
This solution works:

$('body').on('click','#yourSelector',function(event) {//do somethings 
here});

You need to stick the event on the body (or any other parent dom object 
that is not updated, using body is the safe way), so the event still works 
if html is added by an ajax request.

Op dinsdag 10 juli 2012 05:18:55 UTC+2 schreef Sanjeev Divekar het volgende:

 I have already tried this but not working.

 On Mon, Jul 9, 2012 at 10:50 PM, lowpass zijn.d...@gmail.comjavascript:
  wrote:

 On Mon, Jul 9, 2012 at 12:20 AM, sanjeev sanjeev...@gmail.comjavascript: 
 wrote:
  Fist Time it works but after div updated submit click doesn't work. I 
 think
  click event lost.

 Yes, that's likely the problem. I've never used livequery so could not
 say for sure. I think it should be sufficient to either use JQuery's
 live() or create a callback that is run when the content loads that
 initiates the event handler. But you're using Cake's JS helper, which
 I never bother with, so I can't say more about that.

 Also, your selector could be made a bit more efficient if you wrap the
 links with something rather than have to parse the URL of all links on
 the page. Something like:

 $('div.Pagination a, #searchButton')

 --
 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+u...@googlegroups.com javascript: For more options, visit 
 this group at http://groups.google.com/group/cake-php




 -- 
 Warm Regards,
 Sanjeev
 http://sanjeevdivekar.wordpress.com


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Ajax Pagination with Filter Plugin Problem

2013-06-07 Thread Sanjeev Divekar
Thanks Yorick,

Can you explain a bit more.?

Regards,


On Fri, Jun 7, 2013 at 1:02 AM, Yorick Horrie yorickhor...@gmail.comwrote:

 Hi,

 Don't know if you found this allready, but for those who are reading this
 and have the same problem.
 This solution works:

 $('body').on('click','#yourSelector',function(event) {//do somethings
 here});

 You need to stick the event on the body (or any other parent dom object
 that is not updated, using body is the safe way), so the event still works
 if html is added by an ajax request.

 Op dinsdag 10 juli 2012 05:18:55 UTC+2 schreef Sanjeev Divekar het
 volgende:

 I have already tried this but not working.

 On Mon, Jul 9, 2012 at 10:50 PM, lowpass zijn.d...@gmail.com wrote:

 On Mon, Jul 9, 2012 at 12:20 AM, sanjeev sanjeev...@gmail.com wrote:
  Fist Time it works but after div updated submit click doesn't work. I
 think
  click event lost.

 Yes, that's likely the problem. I've never used livequery so could not
 say for sure. I think it should be sufficient to either use JQuery's
 live() or create a callback that is run when the content loads that
 initiates the event handler. But you're using Cake's JS helper, which
 I never bother with, so I can't say more about that.

 Also, your selector could be made a bit more efficient if you wrap the
 links with something rather than have to parse the URL of all links on
 the page. Something like:

 $('div.Pagination a, #searchButton')

 --
 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+u...@**googlegroups.com For more options, visit this group at
 http://groups.google.com/**group/cake-phphttp://groups.google.com/group/cake-php




 --
 Warm Regards,
 Sanjeev
 http://sanjeevdivekar.**wordpress.comhttp://sanjeevdivekar.wordpress.com

  --
 Like Us on FaceBook https://www.facebook.com/CakePHP
 Find us on Twitter http://twitter.com/CakePHP

 ---
 You received this message because you are subscribed to a topic in the
 Google Groups CakePHP group.
 To unsubscribe from this topic, visit
 https://groups.google.com/d/topic/cake-php/kNt2K7oezBE/unsubscribe?hl=en.
 To unsubscribe from this group and all its topics, send an email to
 cake-php+unsubscr...@googlegroups.com.
 To post to this group, send email to cake-php@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php?hl=en.
 For more options, visit https://groups.google.com/groups/opt_out.






-- 
Warm Regards,
Sanjeev
http://sanjeevdivekar.wordpress.com

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Ajax Pagination using elements - only each second link is using ajax function

2013-02-14 Thread Michael Bartos
Be sure to render the JavaScript code *outside* of your update DIV.

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Ajax pagination returns the whole page instead of the requested div

2012-09-17 Thread Miqdad Ali
Try this one..

Add this code starting..

?php
 if ($isAjax):
  $this-layout = '';
 endif;
?

-
Miqdad Ali K
+919995258790
http://www.miqdadalik.com




On Fri, Aug 31, 2012 at 4:29 AM, darkangel luisill...@gmail.com wrote:

 Did you fix it? I'm facing the same issue :S


 On Sunday, July 1, 2012 12:27:27 PM UTC-6, JonStark wrote:

 Thanks for the head up !

 But still, doesn't solve my problem :(

 Whenever I try to paginate a update just a given div, I get the full
 layout in response

 Le dimanche 1 juillet 2012 20:18:10 UTC+2, MaJerle.Eu a écrit :

 just use $this-request-is('ajax')

 you don't need to include RequestHandler component.
 OFC, you have to be on 2.x cake that will work this :)

 ?php echo $this-element('posts'); ?/div

 why si /div there ?

 --
 Lep pozdrav, Tilen Majerle
 http://majerle.eu



 2012/7/1 JonStark

 Hello everyone.

 I'm trying to do a Twitter style auto- load more when scrolling :

  ?php if (!$isAjax):?

div id=postList
?php endif;?

?php echo $this-element('posts'); ?/div

?php if (!$isAjax):?
/div
?php endif;?

?php if (!$isAjax):?
 ?php
 echo $this-Html-script('jquery', false);
 $maxPage = $this-Paginator-counter('%**pages%');
 ?
 script type=text/javascript
 var lastX = 0;
 var currentX = 0;
 var page = 1;
 $(window).scroll(function () {
 if (page  ?php echo $maxPage;?) {
 currentX = $(window).scrollTop();
 if (currentX - lastX  300 * page) {
 lastX = currentX;
 page++;
 $.get('posts/page:' + page, function(data) {
 $('#postList').append(data);
 });
 }
 }
 });
 /script
?php endif;?

?php echo $this-Js-writeBuffer(); ?

 This should updates only the div postList but it returns the whole
 page in the view. In my controller, I have public $components =
 array('RequestHandler'); activated, and $this-set('isAjax',
 $this-RequestHandler-isAjax(**)); in my function. What am I doing
 wrong ? Thanks a lot !

  --
 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+u...@**googlegroups.com For more options, visit this group at
 http://groups.google.com/**group/cake-phphttp://groups.google.com/group/cake-php


  --
 You received this message because you are subscribed to the Google Groups
 CakePHP group.
 To post to this group, send email to cake-php@googlegroups.com.
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com.
 Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




-- 
Like Us on FacekBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en.




Re: Ajax pagination returns the whole page instead of the requested div

2012-08-30 Thread darkangel
Did you fix it? I'm facing the same issue :S

On Sunday, July 1, 2012 12:27:27 PM UTC-6, JonStark wrote:

 Thanks for the head up !

 But still, doesn't solve my problem :(

 Whenever I try to paginate a update just a given div, I get the full 
 layout in response

 Le dimanche 1 juillet 2012 20:18:10 UTC+2, MaJerle.Eu a écrit :

 just use $this-request-is('ajax')

 you don't need to include RequestHandler component.
 OFC, you have to be on 2.x cake that will work this :)

 ?php echo $this-element('posts'); ?/div 

 why si /div there ?

 --
 Lep pozdrav, Tilen Majerle
 http://majerle.eu



 2012/7/1 JonStark

 Hello everyone.

 I'm trying to do a Twitter style auto- load more when scrolling :

  ?php if (!$isAjax):?

div id=postList
?php endif;?
 
?php echo $this-element('posts'); ?/div
 
?php if (!$isAjax):?
/div
?php endif;?
 
?php if (!$isAjax):?
 ?php
 echo $this-Html-script('jquery', false);
 $maxPage = $this-Paginator-counter('%pages%');
 ?
 script type=text/javascript
 var lastX = 0;
 var currentX = 0;
 var page = 1;
 $(window).scroll(function () {
 if (page  ?php echo $maxPage;?) {
 currentX = $(window).scrollTop();
 if (currentX - lastX  300 * page) {
 lastX = currentX;
 page++;
 $.get('posts/page:' + page, function(data) {
 $('#postList').append(data);
 });
 }
 }
 });
 /script
?php endif;?
 
?php echo $this-Js-writeBuffer(); ?

 This should updates only the div postList but it returns the whole 
 page in the view. In my controller, I have public $components = 
 array('RequestHandler'); activated, and $this-set('isAjax', 
 $this-RequestHandler-isAjax()); in my function. What am I doing wrong ? 
 Thanks a lot !

  -- 
 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+u...@googlegroups.com javascript: For more options, visit 
 this group at http://groups.google.com/group/cake-php




-- 
You received this message because you are subscribed to the Google Groups 
CakePHP group.
To post to this group, send email to cake-php@googlegroups.com.
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php?hl=en-US.




Re: Ajax Pagination with Filter Plugin Problem

2012-07-09 Thread lowpass
On Mon, Jul 9, 2012 at 12:20 AM, sanjeev sanjeevdive...@gmail.com wrote:
 Fist Time it works but after div updated submit click doesn't work. I think
 click event lost.

Yes, that's likely the problem. I've never used livequery so could not
say for sure. I think it should be sufficient to either use JQuery's
live() or create a callback that is run when the content loads that
initiates the event handler. But you're using Cake's JS helper, which
I never bother with, so I can't say more about that.

Also, your selector could be made a bit more efficient if you wrap the
links with something rather than have to parse the URL of all links on
the page. Something like:

$('div.Pagination a, #searchButton')

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax Pagination with Filter Plugin Problem

2012-07-09 Thread Sanjeev Divekar
I have already tried this but not working.

On Mon, Jul 9, 2012 at 10:50 PM, lowpass zijn.digi...@gmail.com wrote:

 On Mon, Jul 9, 2012 at 12:20 AM, sanjeev sanjeevdive...@gmail.com wrote:
  Fist Time it works but after div updated submit click doesn't work. I
 think
  click event lost.

 Yes, that's likely the problem. I've never used livequery so could not
 say for sure. I think it should be sufficient to either use JQuery's
 live() or create a callback that is run when the content loads that
 initiates the event handler. But you're using Cake's JS helper, which
 I never bother with, so I can't say more about that.

 Also, your selector could be made a bit more efficient if you wrap the
 links with something rather than have to parse the URL of all links on
 the page. Something like:

 $('div.Pagination a, #searchButton')

 --
 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+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php




-- 
Warm Regards,
Sanjeev
http://sanjeevdivekar.wordpress.com

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax Pagination with Filter Plugin Problem

2012-07-08 Thread sanjeev
Fist Time it works but after div updated submit click doesn't work. I think 
click event lost.

On Saturday, 7 July 2012 23:24:11 UTC+5:30, cricket wrote:

 Please define doesn't work. 

 On Sat, Jul 7, 2012 at 7:44 AM, sanjeev sanjeevdive...@gmail.com wrote: 
  Hello, 
  
  I am using Ajax Pagination with the help of livequery.js with following 
 code 
  in layout 
  
  $('a[href*=sort:],a[href*=page:],#searchButton').livequery('click', 
  function(){ 
  $('#content').load($(this).attr('href')); 
  return false; 
  }); 
  I put #searchButton with help of Js::submit() function for search 
 records 
  which doesn't work 
  
  Thanks in advance. 
  
  Regards, 
  
  Sanjeev Divekar 
  
  -- 
  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+unsubscr...@googlegroups.com For more options, visit this 
 group at 
  http://groups.google.com/group/cake-php 


-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax Pagination with Filter Plugin Problem

2012-07-07 Thread lowpass
Please define doesn't work.

On Sat, Jul 7, 2012 at 7:44 AM, sanjeev sanjeevdive...@gmail.com wrote:
 Hello,

 I am using Ajax Pagination with the help of livequery.js with following code
 in layout

 $('a[href*=sort:],a[href*=page:],#searchButton').livequery('click',
 function(){
 $('#content').load($(this).attr('href'));
 return false;
 });
 I put #searchButton with help of Js::submit() function for search records
 which doesn't work

 Thanks in advance.

 Regards,

 Sanjeev Divekar

 --
 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+unsubscr...@googlegroups.com For more options, visit this group at
 http://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax pagination returns the whole page instead of the requested div

2012-07-03 Thread lowpass
I can't speak to the example code you provided as I don't use Cake's
JSHelper for AJAX.

Does the full layout include the data you wanted? Or does it just have
what you'd see when first arriving at the page? Does your controller
action have a redirect? Does the returned HTML include an error or
notice of any kind?

On Sun, Jul 1, 2012 at 2:27 PM, JonStark jean...@gmail.com wrote:
 Thanks for the head up !

 But still, doesn't solve my problem :(

 Whenever I try to paginate a update just a given div, I get the full layout
 in response

 Le dimanche 1 juillet 2012 20:18:10 UTC+2, MaJerle.Eu a écrit :

 just use $this-request-is('ajax')

 you don't need to include RequestHandler component.
 OFC, you have to be on 2.x cake that will work this :)

 ?php echo $this-element('posts'); ?/div

 why si /div there ?

 --
 Lep pozdrav, Tilen Majerle
 http://majerle.eu



 2012/7/1 JonStark

 Hello everyone.

 I'm trying to do a Twitter style auto- load more when scrolling :

  ?php if (!$isAjax):?

   div id=postList
   ?php endif;?

   ?php echo $this-element('posts'); ?/div

   ?php if (!$isAjax):?
   /div
   ?php endif;?

   ?php if (!$isAjax):?
   ?php
   echo $this-Html-script('jquery', false);
   $maxPage = $this-Paginator-counter('%pages%');
   ?
   script type=text/javascript
   var lastX = 0;
   var currentX = 0;
   var page = 1;
   $(window).scroll(function () {
   if (page  ?php echo $maxPage;?) {
   currentX = $(window).scrollTop();
   if (currentX - lastX  300 * page) {
   lastX = currentX;
   page++;
   $.get('posts/page:' + page, function(data) {
   $('#postList').append(data);
   });
   }
   }
   });
   /script
   ?php endif;?

   ?php echo $this-Js-writeBuffer(); ?

 This should updates only the div postList but it returns the whole page
 in the view. In my controller, I have public $components =
 array('RequestHandler'); activated, and $this-set('isAjax',
 $this-RequestHandler-isAjax()); in my function. What am I doing wrong ?
 Thanks a lot !

 --
 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+unsubscr...@googlegroups.com For more options, visit this group
 at http://groups.google.com/group/cake-php


 --
 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+unsubscr...@googlegroups.com For more options, visit this group at
 http://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax pagination returns the whole page instead of the requested div

2012-07-01 Thread JonStark
Thanks for the head up !

But still, doesn't solve my problem :(

Whenever I try to paginate a update just a given div, I get the full layout 
in response

Le dimanche 1 juillet 2012 20:18:10 UTC+2, MaJerle.Eu a écrit :

 just use $this-request-is('ajax')

 you don't need to include RequestHandler component.
 OFC, you have to be on 2.x cake that will work this :)

 ?php echo $this-element('posts'); ?/div 

 why si /div there ?

 --
 Lep pozdrav, Tilen Majerle
 http://majerle.eu



 2012/7/1 JonStark

 Hello everyone.

 I'm trying to do a Twitter style auto- load more when scrolling :

  ?php if (!$isAjax):?

div id=postList
?php endif;?
 
?php echo $this-element('posts'); ?/div
 
?php if (!$isAjax):?
/div
?php endif;?
 
?php if (!$isAjax):?
 ?php
 echo $this-Html-script('jquery', false);
 $maxPage = $this-Paginator-counter('%pages%');
 ?
 script type=text/javascript
 var lastX = 0;
 var currentX = 0;
 var page = 1;
 $(window).scroll(function () {
 if (page  ?php echo $maxPage;?) {
 currentX = $(window).scrollTop();
 if (currentX - lastX  300 * page) {
 lastX = currentX;
 page++;
 $.get('posts/page:' + page, function(data) {
 $('#postList').append(data);
 });
 }
 }
 });
 /script
?php endif;?
 
?php echo $this-Js-writeBuffer(); ?

 This should updates only the div postList but it returns the whole 
 page in the view. In my controller, I have public $components = 
 array('RequestHandler'); activated, and $this-set('isAjax', 
 $this-RequestHandler-isAjax()); in my function. What am I doing wrong ? 
 Thanks a lot !

  -- 
 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+unsubscr...@googlegroups.com For more options, visit this group 
 at http://groups.google.com/group/cake-php




-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax Pagination not working ?

2012-06-23 Thread JonStark
No one has a clue ? This is driving me crazy.

Thanks a lot.

Le vendredi 22 juin 2012 18:03:11 UTC+2, JonStark a écrit :

 I don't understand why ajax pagination won't work on my app.

 In my Users controller :

 ?php
 class UsersController extends AppController {
 public $name = 'Users';
 public $helpers = array('Html', 'Form', 'Paginator', '*Js*');
 public $components = array('*RequestHandler*');


 In my layout :

 !-- Javascript --
 script src=//
 ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js 
 type=text/javascript/script

 !-- Loading gif --
 ?php echo $this-Html-image('loading.gif', array('id' = 
 'busy-indicator')); ? 


 And in User/view.ctp

 A div with Id post

 div id=posts Content to paginate  /div


 The pagination :

 ?php $this-Paginator-options(array(
   'update' = '#posts',
   'evalScripts' = true,
   'before' = $this-Js-get('#busy-indicator')-effect('fadeIn', 
 array('buffer' = false)),
   'complete' = $this-Js-get('#busy-indicator')-effect('fadeOut', 
 array('buffer' = false)),
)); ?

div style=text-align: center;
?php 
if ($this-Paginator-hasPage(2)) {
echo $this-Paginator-prev();
echo ( | );
} ? 
?php echo $this-Paginator-numbers(); ? 
?php 
if ($this-Paginator-hasPage(2)) { 
echo ( | );
echo $this-Paginator-next();
} ?

?php echo $this-Js-writeBuffer(); ?
/div



  But this ouputs the standard HTML paginator... I'm lost here.

 Any idea ? Thanks a lot.


-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax Pagination not working ?

2012-06-23 Thread Andras Kende
I think Paginator-numbers, Paginator-next, Paginator-prev has to be inside 
the div id=posts…../div

Andras Kende

On Jun 23, 2012, at 1:54 AM, JonStark wrote:

 No one has a clue ? This is driving me crazy.
 
 Thanks a lot.
 
 Le vendredi 22 juin 2012 18:03:11 UTC+2, JonStark a écrit :
 I don't understand why ajax pagination won't work on my app.
 
 In my Users controller :
 
 ?php
 class UsersController extends AppController {
 public $name = 'Users';
 public $helpers = array('Html', 'Form', 'Paginator', 'Js');
 public $components = array('RequestHandler');
 
 In my layout :
 
 !-- Javascript --
 script src=//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js 
 type=text/javascript/script

 !-- Loading gif --
 ?php echo $this-Html-image('loading.gif', array('id' = 
 'busy-indicator')); ? 
 
 And in User/view.ctp
 
 A div with Id post
 
 div id=posts Content to paginate  /div
 
 The pagination :
 
 ?php $this-Paginator-options(array(
   'update' = '#posts',
   'evalScripts' = true,
   'before' = 
 $this-Js-get('#busy-indicator')-effect('fadeIn', array('buffer' = false)),
   'complete' = 
 $this-Js-get('#busy-indicator')-effect('fadeOut', array('buffer' = 
 false)),
   )); ?
   
   div style=text-align: center;
   ?php 
   if ($this-Paginator-hasPage(2)) {
   echo $this-Paginator-prev();
   echo ( | );
   } ? 
   ?php echo $this-Paginator-numbers(); ? 
   ?php 
   if ($this-Paginator-hasPage(2)) { 
   echo ( | );
   echo $this-Paginator-next();
   } ?
   
   ?php echo $this-Js-writeBuffer(); ?
   /div
 
 
  But this ouputs the standard HTML paginator... I'm lost here.
 
 Any idea ? Thanks a lot.
 
 -- 
 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+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax Pagination not working ?

2012-06-23 Thread JonStark
Actually, the pagination is inside the div, I mis-explained in my question, 
so it must not be this...

This is the full code for info :

//rest of the page

div id=posts
  
  div class=well style=padding: 20px 10px 20px 10px; font-size: 14px;
  
  ?php 
  if (empty($posts)) {
  echo(No status yet.); 
  } ?
  
  ?php foreach ($posts as $post): ?
  
  ?php echo $post['Post']['content']; ?
   
 hr
  
  ?php endforeach; ?
  
   ?php $this-Paginator-options(array(
  'update' = '#posts',
  'evalScripts' = true,
  'before' = $this-Js-get('#busy-indicator')-effect('fadeIn', 
array('buffer' = false)),
  'complete' = $this-Js-get('#busy-indicator')-effect('fadeOut', 
array('buffer' = false)),
   )); ?
   
   div style=text-align: center;
   ?php 
   if ($this-Paginator-hasPage(2)) {
   echo $this-Paginator-prev();
   echo ( | );
   } ? 
   ?php echo $this-Paginator-numbers(); ? 
   ?php 
   if ($this-Paginator-hasPage(2)) { 
   echo ( | );
   echo $this-Paginator-next();
   } ?

   /div
  
  /div
  
  /div !--/Content--



Le vendredi 22 juin 2012 18:03:11 UTC+2, JonStark a écrit :

 I don't understand why ajax pagination won't work on my app.

 In my Users controller :

 ?php
 class UsersController extends AppController {
 public $name = 'Users';
 public $helpers = array('Html', 'Form', 'Paginator', '*Js*');
 public $components = array('*RequestHandler*');


 In my layout :

 !-- Javascript --
 script src=//
 ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js 
 type=text/javascript/script

 !-- Loading gif --
 ?php echo $this-Html-image('loading.gif', array('id' = 
 'busy-indicator')); ? 


 And in User/view.ctp

 A div with Id post

 div id=posts Content to paginate  /div


 The pagination :

 ?php $this-Paginator-options(array(
   'update' = '#posts',
   'evalScripts' = true,
   'before' = $this-Js-get('#busy-indicator')-effect('fadeIn', 
 array('buffer' = false)),
   'complete' = $this-Js-get('#busy-indicator')-effect('fadeOut', 
 array('buffer' = false)),
)); ?

div style=text-align: center;
?php 
if ($this-Paginator-hasPage(2)) {
echo $this-Paginator-prev();
echo ( | );
} ? 
?php echo $this-Paginator-numbers(); ? 
?php 
if ($this-Paginator-hasPage(2)) { 
echo ( | );
echo $this-Paginator-next();
} ?

?php echo $this-Js-writeBuffer(); ?
/div



  But this ouputs the standard HTML paginator... I'm lost here.

 Any idea ? Thanks a lot.


-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax Pagination not working ?

2012-06-23 Thread JonStark
The strange thing is that when I inspect with chrome, the script seems to 
be there :

There's an error : Uncaught ReferenceError : $ is not defined

Then the script :


   1. script type=text/javascript
   2. //![CDATA[
   3. $(document).ready(function () {$(#link-187169656).bind(click, 
   function (event){$.ajax({beforeSend:function (XMLHttpRequest) {$(
   #busy-indicator).fadeIn();}, complete:function (XMLHttpRequest, 
   textStatus) {$(#busy-indicator).fadeOut();}, dataType:html, 
   evalScripts:true, success:function (data, textStatus){$(#content).html(
   data);}, url:\/manager\/users\/timeline\/username\/page:2});
   4. Uncaught ReferenceError: $ is not defined http://www.php.net/defined
   5. return false;});
   6. $(#link-672602788).bind(click, function (event) {$.ajax({
   beforeSend:function(XMLHttpRequest) {$(#busy-indicator).fadeIn();}, 
   complete:function(XMLHttpRequest, textStatus) {$(#busy-indicator)
   .fadeOut();}, dataType:html, evalScripts:true, success:function (data, 
   textStatus) {$(#content).html(data);}, url:\/manager\/users\/timeline
   \/username\/page:1});
   7. return false;});
   8. $(#link-1178929767).bind(click, function (event) {$.ajax({
   beforeSend:function(XMLHttpRequest) {$(#busy-indicator).fadeIn();}, 
   complete:function(XMLHttpRequest, textStatus) {$(#busy-indicator)
   .fadeOut();}, dataType:html, evalScripts:true, success:function (data, 
   textStatus) {$(#content).html(data);}, url:\/manager\/users\/timeline
   \/username\/page:2});
   9. return false;});
   10. $(#link-809703014).bind(click, function (event) {$.ajax({
   beforeSend:function(XMLHttpRequest) {$(#busy-indicator).fadeIn();}, 
   complete:function(XMLHttpRequest, textStatus) {$(#busy-indicator)
   .fadeOut();}, dataType:html, evalScripts:true, success:function (data, 
   textStatus) {$(#content).html(data);}, url:\/manager\/users\/timeline
   \/username\/page:4});
   11. return false;});
   12. $(#link-1406013841).bind(click, function (event) {$.ajax({
   beforeSend:function(XMLHttpRequest) {$(#busy-indicator).fadeIn();}, 
   complete:function(XMLHttpRequest, textStatus) {$(#busy-indicator)
   .fadeOut();}, dataType:html, evalScripts:true, success:function (data, 
   textStatus) {$(#content).html(data);}, url:\/manager\/users\/timeline
   \/username\/page:4});
   13. return false;});});
   14. //]]
   15. /script
   

Le vendredi 22 juin 2012 18:03:11 UTC+2, JonStark a écrit :

 I don't understand why ajax pagination won't work on my app.

 In my Users controller :

 ?php
 class UsersController extends AppController {
 public $name = 'Users';
 public $helpers = array('Html', 'Form', 'Paginator', '*Js*');
 public $components = array('*RequestHandler*');


 In my layout :

 !-- Javascript --
 script src=//
 ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js 
 type=text/javascript/script

 !-- Loading gif --
 ?php echo $this-Html-image('loading.gif', array('id' = 
 'busy-indicator')); ? 


 And in User/view.ctp

 A div with Id post

 div id=posts Content to paginate  /div


 The pagination :

 ?php $this-Paginator-options(array(
   'update' = '#posts',
   'evalScripts' = true,
   'before' = $this-Js-get('#busy-indicator')-effect('fadeIn', 
 array('buffer' = false)),
   'complete' = $this-Js-get('#busy-indicator')-effect('fadeOut', 
 array('buffer' = false)),
)); ?

div style=text-align: center;
?php 
if ($this-Paginator-hasPage(2)) {
echo $this-Paginator-prev();
echo ( | );
} ? 
?php echo $this-Paginator-numbers(); ? 
?php 
if ($this-Paginator-hasPage(2)) { 
echo ( | );
echo $this-Paginator-next();
} ?

?php echo $this-Js-writeBuffer(); ?
/div



  But this ouputs the standard HTML paginator... I'm lost here.

 Any idea ? Thanks a lot.


-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax Pagination not working ?

2012-06-23 Thread Andras Kende
google : Uncaught ReferenceError : $ is not defined  this looks like jquery 
not loaded error…

I would put jquery at the top inside head
script src=https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js; 
type=text/javascript/script

Andras Kende
http://www.kende.com



On Jun 23, 2012, at 2:54 AM, JonStark wrote:

 The strange thing is that when I inspect with chrome, the script seems to be 
 there :
 
 There's an error : Uncaught ReferenceError : $ is not defined
 
 Then the script :
 
 script type=text/javascript
 //![CDATA[
 $(document).ready(function () {$(#link-187169656).bind(click, function 
 (event){$.ajax({beforeSend:function (XMLHttpRequest) 
 {$(#busy-indicator).fadeIn();}, complete:function (XMLHttpRequest, 
 textStatus) {$(#busy-indicator).fadeOut();}, dataType:html, 
 evalScripts:true, success:function (data, 
 textStatus){$(#content).html(data);}, 
 url:\/manager\/users\/timeline\/username\/page:2});
 Uncaught ReferenceError: $ is not defined
 return false;});
 $(#link-672602788).bind(click, function (event) 
 {$.ajax({beforeSend:function(XMLHttpRequest) 
 {$(#busy-indicator).fadeIn();}, complete:function(XMLHttpRequest, 
 textStatus) {$(#busy-indicator).fadeOut();}, dataType:html, 
 evalScripts:true, success:function (data, textStatus) 
 {$(#content).html(data);}, 
 url:\/manager\/users\/timeline\/username\/page:1});
 return false;});
 $(#link-1178929767).bind(click, function (event) 
 {$.ajax({beforeSend:function(XMLHttpRequest) 
 {$(#busy-indicator).fadeIn();}, complete:function(XMLHttpRequest, 
 textStatus) {$(#busy-indicator).fadeOut();}, dataType:html, 
 evalScripts:true, success:function (data, textStatus) 
 {$(#content).html(data);}, 
 url:\/manager\/users\/timeline\/username\/page:2});
 return false;});
 $(#link-809703014).bind(click, function (event) 
 {$.ajax({beforeSend:function(XMLHttpRequest) 
 {$(#busy-indicator).fadeIn();}, complete:function(XMLHttpRequest, 
 textStatus) {$(#busy-indicator).fadeOut();}, dataType:html, 
 evalScripts:true, success:function (data, textStatus) 
 {$(#content).html(data);}, 
 url:\/manager\/users\/timeline\/username\/page:4});
 return false;});
 $(#link-1406013841).bind(click, function (event) 
 {$.ajax({beforeSend:function(XMLHttpRequest) 
 {$(#busy-indicator).fadeIn();}, complete:function(XMLHttpRequest, 
 textStatus) {$(#busy-indicator).fadeOut();}, dataType:html, 
 evalScripts:true, success:function (data, textStatus) 
 {$(#content).html(data);}, 
 url:\/manager\/users\/timeline\/username\/page:4});
 return false;});});
 //]]
 /script
 
 Le vendredi 22 juin 2012 18:03:11 UTC+2, JonStark a écrit :
 I don't understand why ajax pagination won't work on my app.
 
 In my Users controller :
 
 ?php
 class UsersController extends AppController {
 public $name = 'Users';
 public $helpers = array('Html', 'Form', 'Paginator', 'Js');
 public $components = array('RequestHandler');
 
 In my layout :
 
 !-- Javascript --
 script src=//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js 
 type=text/javascript/script

 !-- Loading gif --
 ?php echo $this-Html-image('loading.gif', array('id' = 
 'busy-indicator')); ? 
 
 And in User/view.ctp
 
 A div with Id post
 
 div id=posts Content to paginate  /div
 
 The pagination :
 
 ?php $this-Paginator-options(array(
   'update' = '#posts',
   'evalScripts' = true,
   'before' = 
 $this-Js-get('#busy-indicator')-effect('fadeIn', array('buffer' = false)),
   'complete' = 
 $this-Js-get('#busy-indicator')-effect('fadeOut', array('buffer' = 
 false)),
   )); ?
   
   div style=text-align: center;
   ?php 
   if ($this-Paginator-hasPage(2)) {
   echo $this-Paginator-prev();
   echo ( | );
   } ? 
   ?php echo $this-Paginator-numbers(); ? 
   ?php 
   if ($this-Paginator-hasPage(2)) { 
   echo ( | );
   echo $this-Paginator-next();
   } ?
   
   ?php echo $this-Js-writeBuffer(); ?
   /div
 
 
  But this ouputs the standard HTML paginator... I'm lost here.
 
 Any idea ? Thanks a lot.
 
 -- 
 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+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php

-- 
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 

Re: Ajax Pagination not working ?

2012-06-23 Thread JonStark
Ok you were right it worked !

But there's still a little problem (?) :

The ajax works indeed in the div with the correct ID, but it load the* full 
page* again in the div, meaning I have my full page appearing ... in my 
page. The only way to prevent this is to wrap the entire content in the 
div, but then all the other requests on the page are re-sent too.

Is this the way it's supposed to work, reloading the full page  ?

Thanks a lot for your time.



Le samedi 23 juin 2012 12:31:27 UTC+2, Andras Kende a écrit :

 google : Uncaught ReferenceError : $ is not defined  this looks like 
 jquery not loaded error…

 I would put jquery at the top inside head
 script src=
 https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js; 
 type=text/javascript/script

 Andras Kende
 http://www.kende.com



 On Jun 23, 2012, at 2:54 AM, JonStark wrote:

 The strange thing is that when I inspect with chrome, the script seems to 
 be there :

 There's an error : Uncaught ReferenceError : $ is not defined

 Then the script :


1. script type=text/javascript
2. //![CDATA[
3. $(document).ready(function () {$(#link-187169656).bind(click, 
function (event){$.ajax({beforeSend:function (XMLHttpRequest) {$(
#busy-indicator).fadeIn();}, complete:function (XMLHttpRequest, 
textStatus) {$(#busy-indicator).fadeOut();}, dataType:html, 
evalScripts:true, success:function (data, textStatus){$(#content)
.html(data);}, url:\/manager\/users\/timeline\/username\/page:2});
4. Uncaught ReferenceError: $ is not definedhttp://www.php.net/defined
5. return false;});
6. $(#link-672602788).bind(click, function (event) {$.ajax({
beforeSend:function(XMLHttpRequest) {$(#busy-indicator).fadeIn();}, 
complete:function(XMLHttpRequest, textStatus) {$(#busy-indicator)
.fadeOut();}, dataType:html, evalScripts:true, success:function (data, 
textStatus) {$(#content).html(data);}, url:\/manager\/users\/
timeline\/username\/page:1});
7. return false;});
8. $(#link-1178929767).bind(click, function (event) {$.ajax({
beforeSend:function(XMLHttpRequest) {$(#busy-indicator).fadeIn();}, 
complete:function(XMLHttpRequest, textStatus) {$(#busy-indicator)
.fadeOut();}, dataType:html, evalScripts:true, success:function (data, 
textStatus) {$(#content).html(data);}, url:\/manager\/users\/
timeline\/username\/page:2});
9. return false;});
10. $(#link-809703014).bind(click, function (event) {$.ajax({
beforeSend:function(XMLHttpRequest) {$(#busy-indicator).fadeIn();}, 
complete:function(XMLHttpRequest, textStatus) {$(#busy-indicator)
.fadeOut();}, dataType:html, evalScripts:true, success:function (data, 
textStatus) {$(#content).html(data);}, url:\/manager\/users\/
timeline\/username\/page:4});
11. return false;});
12. $(#link-1406013841).bind(click, function (event) {$.ajax({
beforeSend:function(XMLHttpRequest) {$(#busy-indicator).fadeIn();}, 
complete:function(XMLHttpRequest, textStatus) {$(#busy-indicator)
.fadeOut();}, dataType:html, evalScripts:true, success:function (data, 
textStatus) {$(#content).html(data);}, url:\/manager\/users\/
timeline\/username\/page:4});
13. return false;});});
14. //]]
15. /script


 Le vendredi 22 juin 2012 18:03:11 UTC+2, JonStark a écrit :

 I don't understand why ajax pagination won't work on my app.

 In my Users controller :

 ?php
 class UsersController extends AppController {
 public $name = 'Users';
 public $helpers = array('Html', 'Form', 'Paginator', '*Js*');
 public $components = array('*RequestHandler*');


 In my layout :

 !-- Javascript --
 script src=//
 ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js 
 type=text/javascript/script

 !-- Loading gif --
 ?php echo $this-Html-image('loading.gif', array('id' = 
 'busy-indicator')); ? 


 And in User/view.ctp

 A div with Id post

 div id=posts Content to paginate  /div


 The pagination :

 ?php $this-Paginator-options(array(
   'update' = '#posts',
   'evalScripts' = true,
   'before' = $this-Js-get('#busy-indicator')-effect('fadeIn', 
 array('buffer' = false)),
   'complete' = 
 $this-Js-get('#busy-indicator')-effect('fadeOut', array('buffer' = 
 false)),
)); ?

div style=text-align: center;
?php 
if ($this-Paginator-hasPage(2)) {
echo $this-Paginator-prev();
echo ( | );
} ? 
?php echo $this-Paginator-numbers(); ? 
?php 
if ($this-Paginator-hasPage(2)) { 
echo ( | );
echo $this-Paginator-next();
} ?

?php echo $this-Js-writeBuffer(); ?
/div



  But this ouputs the standard HTML paginator... I'm lost here.

 Any idea ? Thanks a lot.


 -- 
 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
 

Re: Ajax Pagination only works once (no javascript loaded)

2012-05-08 Thread Timo Respondek
Thank you for your input, lowpass, and excuse my late reply.

I found out that what I had to do to get it to work the way  I thought
it would work was quite simple - despite my having echo
$this-Js-writeBuffer(); at the end of my default-layout, I've
included the line on every, which of course isn't all too elegant, but
somehow just having it in my default layout doesn't work.


Timo

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax Pagination only works once (no javascript loaded)

2012-04-24 Thread Timo Respondek
Update:

After some questioning in the #cakephp irc channel I've found out or rather
was pointed to the fact that I'd need to rebind my javascript functions.
I've done so for other divs that are loaded into the current dom, but how
would I go about this for my pagination? The links that are created by the
PaginatorHelper when using Ajax look like this:

$(#link-1983047312).bind(click, function (event)
{$.ajax({dataType:html, evalScripts:true, success:function (data,
textStatus) {$(#tableWrap).html(data);},
url:\/companies\/index\/page:1});

Inside a $(document).ready block at the end of the page. Or rather the
links should be bound by live() instead of bind(), is there an easy
way to do this or, alternatively, can someone kindly point me to a
Ajax Pagination example viable for Cake 2.1?


Thanks in advance again


Timo

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax Pagination only works once (no javascript loaded)

2012-04-24 Thread lowpass
This works for me:

$(function()
{
initPagination();
});


function initPagination()
{
$('div.PaginationLinks a').live('click', function(ev)
{
ev.preventDefault();

$('#content').loading();// show spinner

// closest() includes current element
var $container = 
$(this).closest('div.PaginationLinks').parent('div');
var s_top = $container.offset().top;

$.ajax({
url: $(this).attr('href'),
dataType: 'html',
success: function(data, textStatus, XMLHttpRequest)
{
var $data = $(data).fadeTo(0, 0.1);

$('#content').loading(false);   // remove 
spinner

$container.animate(
{ opacity: 0.1 },
500,
function()
{   

// why doesn't replaceWith() 
return the new element?!?
$container.replaceWith($data);

// scroll back up
$data.animate(
{opacity:1},
500,
function()
{
$('html, 
body').animate({ scrollTop: s_top }, 'slow', 'swing');
}
);  

}
);
},
error: function(XMLHttpRequest, textStatus, errorThrown)
{
alert(textStatus);
}
});
});
}

On Tue, Apr 24, 2012 at 5:08 AM, Timo Respondek
timo.responde...@googlemail.com wrote:
 Update:

 After some questioning in the #cakephp irc channel I've found out or rather
 was pointed to the fact that I'd need to rebind my javascript functions.
 I've done so for other divs that are loaded into the current dom, but how
 would I go about this for my pagination? The links that are created by the
 PaginatorHelper when using Ajax look like this:

 $(#link-1983047312).bind(click, function (event)
 {$.ajax({dataType:html, evalScripts:true, success:function (data,
 textStatus) {$(#tableWrap).html(data);},
 url:\/companies\/index\/page:1});

 Inside a $(document).ready block at the end of the page. Or rather the links
 should be bound by live() instead of bind(), is there an easy way to do this
 or, alternatively, can someone kindly point me to a Ajax Pagination example
 viable for Cake 2.1?


 Thanks in advance again



 Timo

 --
 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+unsubscr...@googlegroups.com For more options, visit this group at
 http://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: AJAX Pagination not working on sharedhost

2011-11-27 Thread leigh
Hi Petrisor,

That is great it's working, because it's a compatibility issue might
even be good to log a ticket or write a patch for it.. I might try and
do that.

kind regards,

Leigh

On Nov 27, 7:25 am, Petrisor Buga petri...@theworkshop.ro wrote:
 Thx Leigh,
 After a few days starring into this problem i finally nailed it down
 after comparing different aspects between local server and online
 one.It looks like the problem was endeed in viewPath!
 using this 
 tut.http://bakery.cakephp.org/articles/rtconner/2007/06/29/advanced-pagin...
 and going with the first phrase form 
 herehttp://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#ajax-pa...

 my original piece of code was:if($this-RequestHandler-isAjax()) {
           $this-viewPath = 'elements';             $this-render('paging');  
                 }

 and it was looking for the file: /home/independ/public_html/film/app/
 View/elements/paging.ctp , but using the default cakephp folder
 structure, my pagination .ctp file was laying in the /app/View/
 Elements/ folder (notice the big E on Elements)
 i thought that cakephp would look for the file in this folder, like
 the controller looks automatically in the ../View/Movies for the
 MoviesController, but instead it was looking for the elements folder
 (and because Elements is different from elements on *nix sytems of
 course it would not work)
 the fix was to just modify $this-viewPath = 'Elements'; and for the
 future to specify THE EXACT location of the file!
 Thanks again,Petrisor

 On Nov 25, 9:31 am, leigh phpnote...@gmail.com wrote:







  Hello Petrisor,

  Check $this-viewPath and $this-view in your controller on the ajax
  request to see if they're pointing to  a view file that exists.

  Also are you using cake 2.0?

  Kind regards,

  Leigh

  On Nov 24, 7:08 pm, Petrisor Buga petri...@theworkshop.ro wrote:

   Hy, i've developed a project locally using MAMP on a mac, after i
   moved it online the links generated automatically by cakephp are not
   working anymore, more precisely i get 500 internal server error on
   the ajax-get request and on the response i get:

   Error: The view for MoviesController::index() was not found.
   Error: Confirm you have created the file: /home/independ/public_html/
   film/app/View/elements/paging.ctp

   but the files are there and working, if i comment/remove the 
   $this-Js-writeBuffer(); line (and also remove the ajax functionality) 
   the

   links are working ok.

   i'm guessing it's something related to .htaccess files or file
   permissions somehow but i can't seem to figure them out!
   i tried on 3 different servers a vps, a sharedhost (this is the one
   that needs to work), a linux box and on all it acts the same, only on
   my mac works :|.

   i have also done another basic cakephp application starting from
   scratch that has ajax pagination and no success either :( works
   locally but not online.

   Thanks for taking time reading my problem!

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: AJAX Pagination not working on sharedhost

2011-11-26 Thread Petrisor Buga
Thx Leigh,
After a few days starring into this problem i finally nailed it down
after comparing different aspects between local server and online
one.It looks like the problem was endeed in viewPath!
using this tut. 
http://bakery.cakephp.org/articles/rtconner/2007/06/29/advanced-pagination-1-2
and going with the first phrase form here
http://book.cakephp.org/2.0/en/core-libraries/helpers/js.html#ajax-pagination

my original piece of code was:if($this-RequestHandler-isAjax()) {  
          $this-viewPath = 'elements';             $this-
render('paging');                  }
and it was looking for the file: /home/independ/public_html/film/app/
View/elements/paging.ctp , but using the default cakephp folder
structure, my pagination .ctp file was laying in the /app/View/
Elements/ folder (notice the big E on Elements)
i thought that cakephp would look for the file in this folder, like
the controller looks automatically in the ../View/Movies for the
MoviesController, but instead it was looking for the elements folder
(and because Elements is different from elements on *nix sytems of
course it would not work)
the fix was to just modify $this-viewPath = 'Elements'; and for the
future to specify THE EXACT location of the file!
Thanks again,Petrisor

On Nov 25, 9:31 am, leigh phpnote...@gmail.com wrote:
 Hello Petrisor,

 Check $this-viewPath and $this-view in your controller on the ajax
 request to see if they're pointing to  a view file that exists.

 Also are you using cake 2.0?

 Kind regards,

 Leigh

 On Nov 24, 7:08 pm, Petrisor Buga petri...@theworkshop.ro wrote:







  Hy, i've developed a project locally using MAMP on a mac, after i
  moved it online the links generated automatically by cakephp are not
  working anymore, more precisely i get 500 internal server error on
  the ajax-get request and on the response i get:

  Error: The view for MoviesController::index() was not found.
  Error: Confirm you have created the file: /home/independ/public_html/
  film/app/View/elements/paging.ctp

  but the files are there and working, if i comment/remove the 
  $this-Js-writeBuffer(); line (and also remove the ajax functionality) the

  links are working ok.

  i'm guessing it's something related to .htaccess files or file
  permissions somehow but i can't seem to figure them out!
  i tried on 3 different servers a vps, a sharedhost (this is the one
  that needs to work), a linux box and on all it acts the same, only on
  my mac works :|.

  i have also done another basic cakephp application starting from
  scratch that has ajax pagination and no success either :( works
  locally but not online.

  Thanks for taking time reading my problem!

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: AJAX Pagination not working on sharedhost

2011-11-24 Thread leigh
Hello Petrisor,

Check $this-viewPath and $this-view in your controller on the ajax
request to see if they're pointing to  a view file that exists.

Also are you using cake 2.0?

Kind regards,

Leigh


On Nov 24, 7:08 pm, Petrisor Buga petri...@theworkshop.ro wrote:
 Hy, i've developed a project locally using MAMP on a mac, after i
 moved it online the links generated automatically by cakephp are not
 working anymore, more precisely i get 500 internal server error on
 the ajax-get request and on the response i get:

 Error: The view for MoviesController::index() was not found.
 Error: Confirm you have created the file: /home/independ/public_html/
 film/app/View/elements/paging.ctp

 but the files are there and working, if i comment/remove the 
 $this-Js-writeBuffer(); line (and also remove the ajax functionality) the

 links are working ok.

 i'm guessing it's something related to .htaccess files or file
 permissions somehow but i can't seem to figure them out!
 i tried on 3 different servers a vps, a sharedhost (this is the one
 that needs to work), a linux box and on all it acts the same, only on
 my mac works :|.

 i have also done another basic cakephp application starting from
 scratch that has ajax pagination and no success either :( works
 locally but not online.

 Thanks for taking time reading my problem!

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: ajax pagination cakephp 1.3 - day two cannot get this working.. any tips please

2011-05-14 Thread AD7six


On May 13, 6:32 pm, OldWest ja...@jasonwydro.com wrote:
 Here is my source code snippets:http://bin.cakephp.org/view/327226811

When you tried the example exactly as shown in the book, did it work?

However, you don't need anything like IMO - js belongs in a js file,
not your php source. The best way to do ajax pagination (IMO) is do
_nothing_ relevant in your view/controller files.

and just add something like this to a js file:

addPaging(scope) {
  $('.paging a:not[href^=#]), th a[href*=/page:]',
scope).click(function(e) {
e.preventDefault();

$('.container').load($(this).attr('href'));
addPaging('.container');
  });
}

Or something of the likes.

AD

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax Pagination in Cakephp

2011-03-27 Thread Jeremy Burns | Class Outfit
http://book.cakephp.org/view/1600/Ajax-Pagination

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 28 Mar 2011, at 03:30, Raajesh wrote:

 Hello,
 
 I want to apply the ajax pagination to my application. Please let me
 know how can we implement ajax pagination in cakephp.
 
 Your help will be appreciable..
 
 Thanking you and regards,
 Raajesh
 
 -- 
 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+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax Pagination in Cakephp

2011-03-27 Thread Raajesh
Hi Jeremy ,

Thanks for your valuable reply...

I want to implement Ajax pagination in version 1.2.

I am not able find the sample code for the same..

If you have any...Please let me know

Waiting for your reply...

Thanking you and regards,
Raajesh



On Mar 28, 8:22 am, Jeremy Burns | Class Outfit
jeremybu...@classoutfit.com wrote:
 http://book.cakephp.org/view/1600/Ajax-Pagination

 Jeremy Burns
 Class Outfit

 jeremybu...@classoutfit.comhttp://www.classoutfit.com

 On 28 Mar 2011, at 03:30, Raajesh wrote: Hello,

  I want to apply the ajax pagination to my application. Please let me
  know how can we implement ajax pagination in cakephp.

  Your help will be appreciable..

  Thanking you and regards,
  Raajesh

  --
  Our newest site for the community: CakePHP Video 
  Tutorialshttp://tv.cakephp.org
  Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
  others with their CakePHP related questions.

  To unsubscribe from this group, send email to
  cake-php+unsubscr...@googlegroups.com For more options, visit this group 
  athttp://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax Pagination in Cakephp

2011-03-27 Thread Jeremy Burns | Class Outfit
Here - I did a search for you on the Cake online guide and found this: 
http://book.cakephp.org/view/167/AJAX-Pagination. I guess you *could* have done 
that yourself.

Jeremy Burns
Class Outfit

jeremybu...@classoutfit.com
http://www.classoutfit.com

On 28 Mar 2011, at 05:12, Raajesh wrote:

 Hi Jeremy ,
 
 Thanks for your valuable reply...
 
 I want to implement Ajax pagination in version 1.2.
 
 I am not able find the sample code for the same..
 
 If you have any...Please let me know
 
 Waiting for your reply...
 
 Thanking you and regards,
 Raajesh
 
 
 
 On Mar 28, 8:22 am, Jeremy Burns | Class Outfit
 jeremybu...@classoutfit.com wrote:
 http://book.cakephp.org/view/1600/Ajax-Pagination
 
 Jeremy Burns
 Class Outfit
 
 jeremybu...@classoutfit.comhttp://www.classoutfit.com
 
 On 28 Mar 2011, at 03:30, Raajesh wrote: Hello,
 
 I want to apply the ajax pagination to my application. Please let me
 know how can we implement ajax pagination in cakephp.
 
 Your help will be appreciable..
 
 Thanking you and regards,
 Raajesh
 
 --
 Our newest site for the community: CakePHP Video 
 Tutorialshttp://tv.cakephp.org
 Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help 
 others with their CakePHP related questions.
 
 To unsubscribe from this group, send email to
 cake-php+unsubscr...@googlegroups.com For more options, visit this group 
 athttp://groups.google.com/group/cake-php
 
 -- 
 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+unsubscr...@googlegroups.com For more options, visit this group at 
 http://groups.google.com/group/cake-php

-- 
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+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php


Re: Ajax Pagination - rearrange pages after item deleting

2010-09-03 Thread Mariano C.
Yes, this is what I do actually.
collection() function create my paginated list, after object removing
I recall collection() function but this display first page of list,
even if during deleting process I was at page 3.

On 3 Set, 06:22, Miloš Vučinić milosvuci...@gmail.com wrote:
 I think you should refresh your view and then the pagiation should be
 set as it is supposed to be. I do not have much experience in Ajax so
 I can't really advise you better on how to make your own paginaton ..

 On Sep 2, 4:36 pm, Mariano C. mariano.calan...@gmail.com wrote:



  Suppose to have 3 page, I delete an object from page 2, so I would
  take the first element from page 3 and use it as last element of page
  2, and so on...

  There's an article or tutorial to explain that?

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Ajax Pagination - rearrange pages after item deleting

2010-09-03 Thread cricket
On Fri, Sep 3, 2010 at 6:35 AM, Mariano C. mariano.calan...@gmail.com wrote:
 Yes, this is what I do actually.
 collection() function create my paginated list, after object removing
 I recall collection() function but this display first page of list,
 even if during deleting process I was at page 3.

Create the link in the view so that it will pass the page number (get
it from $this-params['page']) in the AJAX request. Then, adjust the
'page' option when calling paginate().

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Ajax Pagination - rearrange pages after item deleting

2010-09-03 Thread ohcibi
put something like
$(#itemlist).load(/items/index/page:$page #itemlist); into your
delete function

On 2 Sep., 16:36, Mariano C. mariano.calan...@gmail.com wrote:
 Suppose to have 3 page, I delete an object from page 2, so I would
 take the first element from page 3 and use it as last element of page
 2, and so on...

 There's an article or tutorial to explain that?

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Ajax Pagination - rearrange pages after item deleting

2010-09-02 Thread Miloš Vučinić
I think you should refresh your view and then the pagiation should be
set as it is supposed to be. I do not have much experience in Ajax so
I can't really advise you better on how to make your own paginaton ..

On Sep 2, 4:36 pm, Mariano C. mariano.calan...@gmail.com wrote:
 Suppose to have 3 page, I delete an object from page 2, so I would
 take the first element from page 3 and use it as last element of page
 2, and so on...

 There's an article or tutorial to explain that?

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Ajax Pagination cakePHP 1.3 and jQuery // enable the RequestHandler component

2010-08-30 Thread roktok
In the end, the following solution works for me:

1. Modify jquery_engine.php as suggested by ecommy.com:

jquery has live event feature to acomplish that copy
cake/libs/view/helpers/jquery_engine.php to
app/views/helpers/jquery_engine.php
now open jquery_engine.php and on line 181 change the code from:
return sprintf('%s.bind(%s, %s);', $this-selection, $type,
$callback);
to
return sprintf('%s.live(%s, %s);', $this-selection, $type,
$callback); //ecommy.com modified code

2. Adding the writeBuffer at the bottom of the Ajax element:
echo $this-Js-writeBuffer();
as mentioned by many others,

and finally

3. Adding the component RequestHandler in the controller:
var $components = array('RequestHandler');

Without having enabled the RequestHandler, the steps above are
effectless.

Best,
Heiko




On 4 Aug., 20:39, bradmaxs b...@pezzano.com wrote:
 Thank you for your help.  I added the file to the helpers and changed
 the code and nothing changed:(

 Before I had the pagination outside of the element and now I have
 moved it inside the element and it seems to have made a change.

 Before it worked but only if I clicked on the numbers or like I
 explained if I clicked on next but only the first time.  Now it seems
 to work every other link.  So when I go to the page and click on the
 next it goes to the next page without a refresh.  If I click on next
 to go to the third page it does do that within the links but it
 refreshes the page.  So I am getting every other page by ajax.

 Here is the javascript at the bottom.  It still says bind even though
 I added the helper with the changed code.  Is this correct looking.

 script type=text/javascript
 //![CDATA[
 $(document).ready(function () {$(#link-1109729578).bind(click,
 function (event) {$.ajax({dataType:html, success:function (data,
 textStatus) {$(#comment).html(data);}, url:\/thegarage\/view\/22\/
 page:2});
 return false;});
 $(#link-922906323).bind(click, function (event)
 {$.ajax({dataType:html, success:function (data, textStatus) {$
 (#comment).html(data);}, url:\/thegarage\/view\/22\/page:1});
 return false;});
 $(#link-1486848737).bind(click, function (event)
 {$.ajax({dataType:html, success:function (data, textStatus) {$
 (#comment).html(data);}, url:\/thegarage\/view\/22\/page:2});
 return false;});});
 //]]
 /script

 Thank you so much for helping.

 Brad

 On Aug 3, 11:42 pm, ecommy.com bstdevelopm...@gmail.com wrote:

  This is a common problem - and is because jquery doesn't work similar
  with prototype when it comes to executing ajax code inside a page that
  was requested by ajax

  jquery has live event feature to acomplish that copy
  cake/libs/view/helpers/jquery_engine.php to
  app/views/helpers/jquery_engine.php

  now open jquery_engine.php and on line181change the code from:

  return sprintf('%s.bind(%s, %s);', $this-selection, $type,
  $callback);

  to

  return sprintf('%s.live(%s, %s);', $this-selection, $type,
  $callback); //ecommy.com modified code

  On Aug 4, 12:06 am, bradmaxs b...@pezzano.com wrote:

   I have set up pagination following the Mark Story article and it seems
   to work fine EXCEPT my next, previous and number links are not
   updating.

   If I click on next after the first page load, it goes to the next
   comment (cool), however the next link does not update to the third
   page and just stops working.  I can use the number links to each page
   and they work fine but they don't update either so I can never get
   back to page 1 without a refresh and you never know where you are.

   Here is lies the rub.  I am using one model for the main content of
   the page and contain for the comments.  Here is my controller code.

   // VIEW
           function view($id = null) {
                   if (!$id) {
                           $this-Session-setFlash(sprintf(__('Invalid %s', 
   true), 'cshow'));
                           $this-redirect(array('action' = 'index'));
                   }
                   $this-set('cshow', $this-Cshow-read(null, $id));
                   $this-paginate = array(
                           'contain' = array(
                                   'User' = array(
                                           'UserPreference.image'
                                   ),
                           ),
                           'fields' = array(
                                   'CshowComment.id', 
   'CshowComment.user_id', 'CshowComment.comment',
   'CshowComment.created', 'User.id', 'User.username'
                           ),
                           'conditions' = array(
                                   'CshowComment.cshow_id' = $id
                           ),
                           'recursive' = 0,
                           'limit' = 1,
                           'order' =  array(
                                   'CshowComment.created' = 'desc'
                           )
                   );
                   $this-set('cshowComment', 
   

Re: Ajax Pagination cakePHP 1.3 and jQuery

2010-08-04 Thread ecommy.com
This is a common problem - and is because jquery doesn't work similar
with prototype when it comes to executing ajax code inside a page that
was requested by ajax

jquery has live event feature to acomplish that copy
cake/libs/view/helpers/jquery_engine.php to
app/views/helpers/jquery_engine.php

now open jquery_engine.php and on line 181 change the code from:

return sprintf('%s.bind(%s, %s);', $this-selection, $type,
$callback);

to

return sprintf('%s.live(%s, %s);', $this-selection, $type,
$callback); //ecommy.com modified code

On Aug 4, 12:06 am, bradmaxs b...@pezzano.com wrote:
 I have set up pagination following the Mark Story article and it seems
 to work fine EXCEPT my next, previous and number links are not
 updating.

 If I click on next after the first page load, it goes to the next
 comment (cool), however the next link does not update to the third
 page and just stops working.  I can use the number links to each page
 and they work fine but they don't update either so I can never get
 back to page 1 without a refresh and you never know where you are.

 Here is lies the rub.  I am using one model for the main content of
 the page and contain for the comments.  Here is my controller code.

 // VIEW
         function view($id = null) {
                 if (!$id) {
                         $this-Session-setFlash(sprintf(__('Invalid %s', 
 true), 'cshow'));
                         $this-redirect(array('action' = 'index'));
                 }
                 $this-set('cshow', $this-Cshow-read(null, $id));
                 $this-paginate = array(
                         'contain' = array(
                                 'User' = array(
                                         'UserPreference.image'
                                 ),
                         ),
                         'fields' = array(
                                 'CshowComment.id', 'CshowComment.user_id', 
 'CshowComment.comment',
 'CshowComment.created', 'User.id', 'User.username'
                         ),
                         'conditions' = array(
                                 'CshowComment.cshow_id' = $id
                         ),
                         'recursive' = 0,
                         'limit' = 1,
                         'order' =  array(
                                 'CshowComment.created' = 'desc'
                         )
                 );
                 $this-set('cshowComment', $this-paginate('CshowComment'));
                 if ($this-RequestHandler-isAjax()) {
                         $this-render('/elements/comments');
                         return;
                 }
                 $this-set('title_for_layout', 'eGarage.tv - View The Garage 
 Show');
         }

 In the view:

 div id=comment
 ?php echo $this-element('comments'); ?
 /div
 div class=clear spacer/div
 div class=paging
 ?php $paginator-options(array('update' = '#comment')); ?
 ?php echo $this-Paginator-prev(' '.__('previous', true), array(),
 null, array('class'='disabled'));? | ?php echo 
 $this-Paginator-numbers();? |

 ?php echo $this-Paginator-next(__('next', true).' ', array(),
 null, array('class' = 'disabled'));? ?php echo 
 $this-Paginator-counter(array('format' = __('%page% of %pages%, %count% 
 Comments',

 true)));?
 /div

 and I have included the Js helper and the RequestHandler component in
 my appController as well as ?php echo $this-Js-writeBuffer();  ?
 in my default layout right before the /body tag.

 Not sure if this could be the problem but I am serving jQuery from a
 CDN and not from the webroot/js folder.

 I am using an element because if I don't the page duplicates the
 content that I am trying to update instead of loading via AJAX.  This
 may be the problem but I am stuck.

 I can post other code if this doesn't tell the whole story.

 Thanks in advance.

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 cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscr...@googlegroups.com For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en


Re: Ajax Pagination cakePHP 1.3 and jQuery

2010-08-04 Thread bradmaxs
Thank you for your help.  I added the file to the helpers and changed
the code and nothing changed:(

Before I had the pagination outside of the element and now I have
moved it inside the element and it seems to have made a change.

Before it worked but only if I clicked on the numbers or like I
explained if I clicked on next but only the first time.  Now it seems
to work every other link.  So when I go to the page and click on the
next it goes to the next page without a refresh.  If I click on next
to go to the third page it does do that within the links but it
refreshes the page.  So I am getting every other page by ajax.

Here is the javascript at the bottom.  It still says bind even though
I added the helper with the changed code.  Is this correct looking.

script type=text/javascript
//![CDATA[
$(document).ready(function () {$(#link-1109729578).bind(click,
function (event) {$.ajax({dataType:html, success:function (data,
textStatus) {$(#comment).html(data);}, url:\/thegarage\/view\/22\/
page:2});
return false;});
$(#link-922906323).bind(click, function (event)
{$.ajax({dataType:html, success:function (data, textStatus) {$
(#comment).html(data);}, url:\/thegarage\/view\/22\/page:1});
return false;});
$(#link-1486848737).bind(click, function (event)
{$.ajax({dataType:html, success:function (data, textStatus) {$
(#comment).html(data);}, url:\/thegarage\/view\/22\/page:2});
return false;});});
//]]
/script

Thank you so much for helping.

Brad

On Aug 3, 11:42 pm, ecommy.com bstdevelopm...@gmail.com wrote:
 This is a common problem - and is because jquery doesn't work similar
 with prototype when it comes to executing ajax code inside a page that
 was requested by ajax

 jquery has live event feature to acomplish that copy
 cake/libs/view/helpers/jquery_engine.php to
 app/views/helpers/jquery_engine.php

 now open jquery_engine.php and on line 181 change the code from:

 return sprintf('%s.bind(%s, %s);', $this-selection, $type,
 $callback);

 to

 return sprintf('%s.live(%s, %s);', $this-selection, $type,
 $callback); //ecommy.com modified code

 On Aug 4, 12:06 am, bradmaxs b...@pezzano.com wrote:



  I have set up pagination following the Mark Story article and it seems
  to work fine EXCEPT my next, previous and number links are not
  updating.

  If I click on next after the first page load, it goes to the next
  comment (cool), however the next link does not update to the third
  page and just stops working.  I can use the number links to each page
  and they work fine but they don't update either so I can never get
  back to page 1 without a refresh and you never know where you are.

  Here is lies the rub.  I am using one model for the main content of
  the page and contain for the comments.  Here is my controller code.

  // VIEW
          function view($id = null) {
                  if (!$id) {
                          $this-Session-setFlash(sprintf(__('Invalid %s', 
  true), 'cshow'));
                          $this-redirect(array('action' = 'index'));
                  }
                  $this-set('cshow', $this-Cshow-read(null, $id));
                  $this-paginate = array(
                          'contain' = array(
                                  'User' = array(
                                          'UserPreference.image'
                                  ),
                          ),
                          'fields' = array(
                                  'CshowComment.id', 'CshowComment.user_id', 
  'CshowComment.comment',
  'CshowComment.created', 'User.id', 'User.username'
                          ),
                          'conditions' = array(
                                  'CshowComment.cshow_id' = $id
                          ),
                          'recursive' = 0,
                          'limit' = 1,
                          'order' =  array(
                                  'CshowComment.created' = 'desc'
                          )
                  );
                  $this-set('cshowComment', $this-paginate('CshowComment'));
                  if ($this-RequestHandler-isAjax()) {
                          $this-render('/elements/comments');
                          return;
                  }
                  $this-set('title_for_layout', 'eGarage.tv - View The 
  Garage Show');
          }

  In the view:

  div id=comment
  ?php echo $this-element('comments'); ?
  /div
  div class=clear spacer/div
  div class=paging
  ?php $paginator-options(array('update' = '#comment')); ?
  ?php echo $this-Paginator-prev(' '.__('previous', true), array(),
  null, array('class'='disabled'));? | ?php echo 
  $this-Paginator-numbers();? |

  ?php echo $this-Paginator-next(__('next', true).' ', array(),
  null, array('class' = 'disabled'));? ?php echo 
  $this-Paginator-counter(array('format' = __('%page% of %pages%, %count% 
  Comments',

  true)));?
  /div

  and I have included the Js helper and the RequestHandler component in
  my appController as