Yiinfinite Scroll not wotking [SOLVED]


I’m using this extension http://www.yiiframework.com/extension/yiinfinite-scroll/ and I can’t make it work.

This is my controller:

        $criteria = new CDbCriteria;

        $criteria->with = array('messages.author');

        $criteria->condition = 't.id = :id';

        $criteria->params = array(':id' => $id);


        $total = Conversation::model()->count(); //I've also tried with ->count($criteria)


        $pages = new CPagination($total);

        $pages->pageSize = 20;



        $model = Conversation::model()->find($criteria);


        $this->render('conversation', array(

            'model' => $model,

            'pages' => $pages


My view:

<div id="todo">

    <?php foreach ($model->messages as $m): ?>

        <div class="conversation">

            <div style="color: black; font-size: 1em;" ><?php echo $m->message; ?></div>

            <div style="color: black; font-size: 1em;" ><?php echo $m->author->fullName; ?></div>


    <?php endforeach; ?>



$this->widget('ext.yiinfinite-scroll.YiinfiniteScroller', array(

    'contentSelector' => '#todo',

    'itemSelector' => 'div.conversation',

    'loadingText' => 'Loading...',

    'donetext' => 'That's all',

    'pages' => $pages,


What am I doing wrong? I’ve tried a few times the examples in the extension site but nothing works.


The problem I was retrieving only a model from the database with all its related messages, which was wrong. The correct way to do it is searching directly for the messages.