yii\widgets\Pjax::run PHP Method

run() public method

public run ( )
    public function run()
    {
        if (!$this->requiresPjax()) {
            echo Html::endTag(ArrayHelper::remove($this->options, 'tag', 'div'));
            $this->registerClientScript();
            return;
        }
        $view = $this->getView();
        $view->endBody();
        // Do not re-send css files as it may override the css files that were loaded after them.
        // This is a temporary fix for https://github.com/yiisoft/yii2/issues/2310
        // It should be removed once pjax supports loading only missing css files
        $view->cssFiles = null;
        $view->endPage(true);
        $content = ob_get_clean();
        // only need the content enclosed within this widget
        $response = Yii::$app->getResponse();
        $response->clearOutputBuffers();
        $response->setStatusCode(200);
        $response->format = Response::FORMAT_HTML;
        $response->content = $content;
        $response->send();
        Yii::$app->end();
    }

Usage Example

示例#1
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     if ($this->requiresPjax()) {
         echo Notify::widget($this->notifyOptions);
     }
     $id = $this->options['id'];
     if ($this->modal) {
         $this->getView()->registerJs("Admin.Modal.pjax('#{$id}');");
     }
     parent::run();
 }
All Usage Examples Of yii\widgets\Pjax::run