Skip to content

Commit

Permalink
Исправление обработки вложенных виджетов при ajax загрузке
Browse files Browse the repository at this point in the history
  • Loading branch information
petrgrishin committed Aug 3, 2014
1 parent 3f997eb commit 93f3e2c
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/ViewRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,10 @@ public static function className() {
public function renderFile($context, $sourceFile, $params, $isReturn) {
$viewId = $this->generateViewId($sourceFile);
$view = new View($viewId, $context);
if ($context instanceof Widget) {
$context->setView($view);
}
$isContextWidget = $this->isContextWidget($context) && $context->setView($view);
$view->setParams($params);
$view->setScriptFile($this->getScriptFile($sourceFile));
if ($this->isAjaxRequest()) {
if (!$isContextWidget && $this->isAjaxRequest()) {
$response = $this->renderAjax($view, $sourceFile);
$this->getScriptProcessor()->processView($view, true);
} else {
Expand Down Expand Up @@ -87,6 +85,10 @@ protected function isAjaxRequest() {
return $this->getRequest()->getIsAjaxRequest();
}

protected function isContextWidget($context) {
return $context instanceof Widget;
}

/**
* @param $sourceFile
* @return string
Expand Down

0 comments on commit 93f3e2c

Please sign in to comment.