Saturday, June 23, 2012

Re: Ajax Pagination not working ?

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

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate