Yii Framework Forum: yiinfinite-scroll - extension not working for me - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

yiinfinite-scroll - extension not working for me Not able to use ajaxlink in yiinfinite-scroll - extension Rate Topic: -----

#1 User is offline   alanselvam 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 02-May 11

Posted 31 July 2012 - 09:24 AM

Hi, i have used this extension and facing one issue. Here's my code

In protected/view folder, my index.php file

<div id="posts" class="span5">
<?php foreach($posts as $post): ?>
    <div class="post">
        <div class="row ">
            $this->beginWidget('CMarkdown', array('purifyOutput'=>true));
            echo $post->content;
      <div class="row">
        <?php echo CHtml::link('<i class="icon-comment"></i> Comments ('.$post->commentCount.')',$post->url.'#comments'); ?> 
        <?php echo "id".$post->id;?>
       <?php echo CHtml::htmlButton('<i class="icon-cog icon-white"></i> Subscribe',
             'class'=>'btn btn-success',
             'ajax' => array(
                                        'beforeSend' => 'function(){
                                    'complete' => 'function(){
              <div id="userIdAvailability">
            <span style="" id="userIdLoading">Loading...</span></div>
<?php endforeach; ?>
<?php $this->widget('ext.yiinfinite-scroll.YiinfiniteScroller', array(
    'contentSelector' => '#posts',
    'itemSelector' => 'div.post',
    'loadingText' => 'Loading...',
    'donetext' => 'This is the end... my only friend, the end',
    'pages' => $pages,
)); ?>

My controller file postcontroller.php

public function actionIndex()
        $model=new Post;
        $criteria = new CDbCriteria;
            $total = Post::model()->count();
            $pages = new CPagination($total);
            $pages->pageSize = 5;
            $posts = Post::model()->findAll($criteria);
        $this->render('index', array(
                'posts' => $posts,
                'pages' => $pages,
                'model' => $model

Noticed Issue:

In ajax button link click, i am not getting proper post id value, I put page size value as 5. Based on this, In every 5 post, I am getting ajax id value 1 to 5. If loader loading next set of 5 posts then it will reset those post id values. I mean, next 5 to 10 post also, i am getting post id values as 1 to 6.


I am trying to implement this extension with twitter bootstrap yii extension.

Please help me to resolve this issue

Share this topic:

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users