From 72ff9c58df1a73b914eb8c3992cfdf1d62a2bbff Mon Sep 17 00:00:00 2001 From: Alex-Code Date: Mon, 24 Feb 2014 15:56:31 +0000 Subject: [PATCH 1/2] Pjax container only required on first load. Pjax inserts the response HTML into the container, it doesn't replace it. So any subsequent pjax requests duplicate the container. --- framework/widgets/Pjax.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/widgets/Pjax.php b/framework/widgets/Pjax.php index 5b25b41176..87f90e1747 100644 --- a/framework/widgets/Pjax.php +++ b/framework/widgets/Pjax.php @@ -102,8 +102,9 @@ class Pjax extends Widget if ($view->title !== null) { echo Html::tag('title', Html::encode($view->title)); } + } else { + echo Html::beginTag('div', $this->options); } - echo Html::beginTag('div', $this->options); } /** @@ -111,9 +112,8 @@ class Pjax extends Widget */ public function run() { - echo Html::endTag('div'); - if (!$this->requiresPjax()) { + echo Html::endTag('div'); $this->registerClientScript(); return; } From f7911bc9ac8553dfe22b986e473b192b4620c789 Mon Sep 17 00:00:00 2001 From: Alex-Code Date: Mon, 24 Feb 2014 15:57:28 +0000 Subject: [PATCH 2/2] Unused? --- framework/widgets/Pjax.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/widgets/Pjax.php b/framework/widgets/Pjax.php index 87f90e1747..1d7046c895 100644 --- a/framework/widgets/Pjax.php +++ b/framework/widgets/Pjax.php @@ -152,7 +152,7 @@ class Pjax extends Widget protected function requiresPjax() { $headers = Yii::$app->getRequest()->getHeaders(); - return $headers->get('X-Pjax') && ($selector = $headers->get('X-Pjax-Container')) === '#' . $this->getId(); + return $headers->get('X-Pjax') && $headers->get('X-Pjax-Container') === '#' . $this->getId(); } /**