Answer the question
In order to leave comments, you need to log in
Why does pjax redirect to a separate page?
Faced a strange work of pjax in yii2, created a normal table output with pagination:
When you click on the numbers 1 or 2 of the LinkPager widget, everything is fine, but when you click 3, it redirects to the controller method:
How can this be?
Output code:
<div class="col s8">
<table class="striped" style="font-size: 12px">
<thead>
<tr>
<th>Логин</th>
<th>Имя</th>
<th>Фамилия</th>
<th>Отчество</th>
<th>Действия</th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $user): ?>
<tr>
<td><?= $user->login ?></td>
<td><?= $user->first_name ?></td>
<td><?= $user->last_name ?></td>
<td><?= $user->middle_name ?></td>
<td></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?= \yii\widgets\LinkPager::widget(['pagination' => $pagination]) ?>
</div>
Answer the question
In order to leave comments, you need to log in
Try setting timeout to false, by default it is 1sec, if the server is not responsible for this time - Pjax redirects to the full page
Pjax::begin([
'enablePushState' => false,
'timeout' => false // or time in ms
])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question