Open pliszka opened 9 years ago
I'm working with ListView widget with some Pjax reload feature as follow:
<?php Pjax::end() ?> <?php $pjax = Pjax::begin(['id' => 'list_content']); ?> <?= ListView::widget([ 'dataProvider' => $dataProvider, 'layout' => "{pager}\n{items}\n{summary}", 'itemView' => function ($model, $key, $index, $widget) { return $this->render('_list_item',['model' => $model]); }, 'pager' => [ 'class' => \kop\y2sp\ScrollPager::className(), 'eventOnReady' => 'function() {scrollPager = this;}', ], ]); ?> <?php Pjax::end(); ?>
<script> var scrollPager; </script> <?php $this->registerJs( '$("document").ready(function(){ $("#filters").on("pjax:end", function() { $.pjax.reload({container:"#list_content"}); }); });' ); ?> <?php Pjax::begin(['id' => 'filters']); ?> <?php $form = ActiveForm::begin([ 'method' => 'get', 'options' => [ 'data-pjax' => true, ], ]); ?> <?= $form->field($searchModel, 'author'); ?> <?= $form->field($searchModel, 'message'); ?> <div class="form-group"> <?= Html::submitButton('Apply', ['class' => 'btn btn-success']) ?> </div> <?php ActiveForm::end(); ?> <?php Pjax::end() ?> <?php $pjax = Pjax::begin(['id' => 'list_content']); ?> <?= ListView::widget([ 'dataProvider' => $dataProvider, 'layout' => "{pager}\n{items}\n{summary}", 'itemView' => function ($model, $key, $index, $widget) { return $this->render('_list_item',['model' => $model]); }, 'pager' => [ 'class' => \kop\y2sp\ScrollPager::className(), 'eventOnReady' => 'function() {scrollPager = this;}', ], ]); ?> <?php Pjax::end(); ?>
scrollPager.reinitialize();
or
scrollPager.next();
$(window).scroll();
each ends with exactly same way.
The link "Load more items" is showing correctly but it's not working.
I could click "Load more items" and get the next "package" of items via Ajax.
Please help.
The same
Has there been any solution to this issue?
Hello, u can use scrollPager.reinitialize(); before pjax success http://stackoverflow.com/questions/21679655/jquery-pjax-ajax-success-function
Some code
I'm working with ListView widget with some Pjax reload feature as follow:
Full code
Steps to reproduce this problem
or
or
each ends with exactly same way.
Actual result
The link "Load more items" is showing correctly but it's not working.
Expected result
I could click "Load more items" and get the next "package" of items via Ajax.
Please help.