I am using the Yii's extension infinite-scroll-pager. My data provider has 6 registers, but I want it to show only the first 3. How can I get it done? Would the triggerPageTreshold
(sic) have to do this job?
$listView = $this->widget(
'zii.widgets.CListView',
array(
'id' => 'activities-scroll-list',
'dataProvider' => $dataProvider,
'itemView' => '/experience/_experience_item',
'cssFile' => null,
'template' => $this->renderPartial(
'/experience/_experiences_list',
array(),
true
),
'pager' => array(
'id' => 'pager-id',
'class' => 'ext.infiniteScroll.IasPager',
'rowSelector' => '.row',
'listViewId' => 'activities-scroll-list',
'header' => 'TESTE',
'loaderText' => 'Loading...',
'options' => array(
'history' => true,
'triggerPageTreshold' => 3,
'trigger' => 'Load more'
)
),
)
);
The /experience/_experiences_list
:
<div class="row">
<div id="home-experience-resume" class="wrapper-k">
<?php
echo '{summary} {items} {pager}';
?>
</div>
</div>
The /experience/_experience_item
:
<article class="column-3 <?= ((($index - 1) % 3) == 0 ? 'middle' : ''); ?> equal-height">
<div class="inner-wrapper">
<div class="img-container">
<img src="/images/tmp_thumbExperiencia1.jpg" alt="<?php echo Yii::t('home','Experiência 1'); ?>" />
</div>
<div class="info-column-container">
<div class="info-column">
<p class="more-detail-link">
<img src="/images/experiences/iconLocal.png" alt="icon local"/>
<a href="#" target="_self"><?= $data->showingCity; ?></a>
</p>
<h3><?= $data->name; ?></h3>
<a class="button bt-small" href="/experience/info/<?php echo $data->id; ?>" target="_self"><?= Yii::t('home','Saber mais'); ?></a>
</div>
</div>
</div>
</article>
Use:
'template' => '<div class="row">div id="home-experience-resume" class="wrapper-k"> {summary} {items} {pager} </div></div>',
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With