Closed matperez closed 8 years ago
Basic app template:
SiteController.php
diff --git a/controllers/SiteController.php b/controllers/SiteController.php
index 33f6227..4c497a8 100644
--- a/controllers/SiteController.php
+++ b/controllers/SiteController.php
@@ -95,6 +95,12 @@ class SiteController extends Controller
]);
}
+ public function actionSleep()
+ {
+ sleep(3);
+ return $this->renderAjax('about');
+ }
+
public function actionAbout()
{
return $this->render('about');
view about.php
diff --git a/views/site/about.php b/views/site/about.php
index 752342c..18220b9 100644
--- a/views/site/about.php
+++ b/views/site/about.php
@@ -17,4 +17,8 @@ $this->params['breadcrumbs'][] = $this->title;
<?= Yii::t('app', 'ru-RU тест') ?>
<code><?= __FILE__ ?></code>
+
+ <?php \yii\widgets\Pjax::begin(['timeout' => 3000]); ?>
+ <a href="/site/sleep">click</a>
+ <?php \yii\widgets\Pjax::end(); ?>
</div>
This code works as expected: clicking on link triggers PJAX request, the client side waits 3 seconds waiting for the response, then navigates to /site/sleep
URL with full page reload.
When I decrease sleep
time in the controller action, PJAX loads the response without page reload.
How to reproduce the problem?
Sorry. It's my fault.
I've used $.pjax.reload to reload the container. Apparently it uses the default timeout value.
Hello!
I noticed that the timeout option has no effect on the behavior of the widget
I'm using it this way
It looks fine in the page source code
But the option has no effect unless I set it globally via $.pjax.defaults.timeout = 3000;
Could it be an issue?