I want to be able to refresh a pjax listview without refreshing the whole page. This is the view just the pjax list itself.
<?= Html::Button('refresh-countries', ['class' => 'btn btn-primary', 'name' => 'login-button', 'id'=>'refresh']) ?>
<?php Pjax::begin(['id' => 'countries']) ?>
<?= ListView::widget([
'dataProvider' => $dataProvider,
'itemOptions' => ['class' => 'comment-item'],
'itemView' => 'commentadapter',
]); ?>
<?php Pjax::end() ?>
Please I want it to refresh onclick of that button and only the listview would refresh. I know how to do it but it refreshes the whole page.
You have to like this:
use yii\widgets\Pjax;
<?php Pjax::begin(['id' => 'some_pjax_id']) ?>
//your code
<?php Pjax::end() ?>
above form contained in tab and here is my script to reload pjax :
$("#my_tab_id").click(function() {
$.pjax.reload({container: '#some_pjax_id', async: false});
});