I’m using scroll pager for my web ; and I’m using pjax for my form
after I submit my form and reload my yii2 scroll pager it not working if I click on : load more items.
when my content is submited and the listview is reloaded the Load more items not working
these is my code for my list view :
<?php Pjax::begin(['id' => 'post-list']) ?>
<?= ListView::widget([
'dataProvider' => $dataProvider,
'summary'=>'',
'itemOptions' => ['class' => 'item'], // LY - FOR ( LOAD MORE )
'itemView' => '/content/views/chnPosts',
'pager' => ['class' => ScrollPager::className()]
]);
?>
<?php Pjax::end() ?>
and my form is :
<script type="text/javascript">
$(document).ready(function (e) {
$('#pjax-glr').on('pjax:success', function() {
console.log('yes');
$("#postgallery-post_text").val('');
$.pjax.reload("#post-list", {timeout : false});
init();
});
});
</script>
<?php Pjax::begin(['id' => 'pjax-glr']); ?>
<?php $form = ActiveForm::begin(['id' => 'upload-gallery', 'options' => ['data-pjax' => true, 'enctype' => 'multipart/form-data']]) ?>
<?= $form->field($model_PstGlr, 'PGalleryFile[]')->fileInput(['multiple' => true, 'accept' => 'image/*']) ?>
<?= $form->field($model_PstGlr, 'post_text')->textarea(['rows' => 2]) ?>
<?= $form->field($model_PstGlr, 'permission_id')->dropdownList($model_Permission->PermissionOn()) ?>
<div class="form-group">
<?= Html::submitButton('Save', ['class' => 'btn btn-success']) ?>
</div>
<?php ActiveForm::end(); ?>
<?php Pjax::end(); ?>