W
W
wolf-98302018-07-14 16:34:34
Yii
wolf-9830, 2018-07-14 16:34:34

Why does pjax redirect to a separate page?

Faced a strange work of pjax in yii2, created a normal table output with pagination:
5b4a139e0c539850629648.png
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:
5b4a13b269c0d803804930.png
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>

And the whole view is wrapped in Pjax::begin(['enablePushState' => false]) and Pjax::end()

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Anisimov, 2018-07-15
@wolf-9830

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 question

Ask a Question

731 491 924 answers to any question