Yii Framework Forum: Clistview Ajax Pagination - Yii Framework Forum

Jump to content

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

Clistview Ajax Pagination Nested list views do not load properly Rate Topic: -----

#1 User is offline   Rallina 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 10
  • Joined: 09-June 11

Posted 14 January 2013 - 04:18 PM

Hi all,

I'm working on a sort of activity feed with items provided by a CListView widget. The declaration for that is here:
<?php
$this->widget('zii.widgets.CListView', array(
	'dataProvider'=>$dataProvider,
	'itemView'=>'_viewEvent', 
        'id'=>'activity-feed',
        'pager' => array(
                    'class' => 'ext.infiniteScroll.IasPager', 
                    'rowSelector'=>'.view.top-level', 
                    'listViewId' => 'activity-feed', 
                    'header' => '',
                    'options'=>array('onRenderComplete'=>'js:function () {
                        $.each($(".list-view"), function(){
                            if(typeof $.fn.yiiListView.settings["\'"+$(this).attr("id")+"\'"]=="undefined")
                                $(this).yiiListView();
                        });
                    }'),
                  ),
	'baseScriptUrl'=>Yii::app()->request->baseUrl.'/themes/'.Yii::app()->theme->name.'/css/listview',
	'template'=>'{pager} {items}',
)); ?>


I'm using an infinite scrolling pagination extension found here: http://www.yiiframew...e-scroll-pager/ (though if I disable this extension and just use default pagination the error happens as well). Each event on this feed has a comments section which has data provided by another CListView widget. Each _viewEvent being rendered by the initial list view has this block of code to initialize the comments list view widget:
<?php 
$this->widget('zii.widgets.CListView', array(
                'dataProvider'=>$commentDataProvider,
                'itemView'=>'../social/_view',
                'template'=>'&nbsp;{items}',
                'id'=>$data->id.'-comments',
            ));?>


The nested list view renders properly on the page but I am unable to do anything with it once it's loaded. Attempting to call $.fn.yiiListView.update(id) does nothing. It used to return an error that the list view was undefined, which is why I added the onRenderComplete javascript to attempt to initialize all the new list views when the outer list view finishes pagination. The ajax request fires perfectly fine when I call update, but nothing happens when it returns and I don't get any sort of error logged.

Any advice here would be much appreciated,
Jake
0

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