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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment