Yii Framework Forum: Yiinfinite Scroll Extension - 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 Thanks! Rate Topic: -----

#1 User is offline   Logan 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 19
  • Joined: 04-March 11

Posted 04 March 2011 - 10:42 PM

Good evening,

I am playing with the Yiinfinite Scroll extension. Works like a charm! It seems the description and how to use it is a little incomplete (atleast for me, as a newbie.) But, if anyone is interested here is how I'm using it:

In the Controller:
public function actionIndex()
{
   $criteria=new CDbCriteria();
   $criteria->select='lastName,firstName';
   $total=Employee::model()->count();
   $pages=new CPagination($total);
   $pages->pageSize=5;
   $pages->applyLimit($criteria);
   $models=Employee::model()->findAll($criteria);

   $this->render('index',array(
      'models'=>$models,
      'pages'=>$pages,
   ));
}


In the View:
<div class="employee-list">
<?php foreach($models as $model): ?>
   <div class="employee-record" style="height:50"><?php echo $model->lastName.', '.$model->firstName; ?><br /></div>
<?php endforeach;?>
</div>
<?php $this->widget('ext.yiinfinite-scroll.YiinfiniteScroller',array(
   'itemSelector'=>'div.employee-record',
   'contentSelector'=>'div.employee-list',
   'pages'=>$pages,
));?>


Hope this helps!
1

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