Yiinfinite Scroll Extension

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!