diff --git a/src/ExportMenu.php b/src/ExportMenu.php index 676fb16..637c18f 100644 --- a/src/ExportMenu.php +++ b/src/ExportMenu.php @@ -860,8 +860,13 @@ protected function initSettings() } $this->_columnSelectorEnabled = $this->showColumnSelector && $this->asDropdown; $request = Yii::$app->request; - $this->_triggerDownload = $request->post($this->exportRequestParam, $this->triggerDownload); - $this->_exportType = $request->post($this->exportTypeParam, $this->exportType); + if ($request instanceof \yii\web\Request) { + $this->_triggerDownload = $request->post($this->exportRequestParam, $this->triggerDownload); + $this->_exportType = $request->post($this->exportTypeParam, $this->exportType); + } else { + $this->_triggerDownload = $this->triggerDownload; + $this->_exportType = $this->exportType; + } if (!$this->stream) { $this->target = self::TARGET_SELF; } @@ -869,7 +874,9 @@ protected function initSettings() if ($this->stream) { Yii::$app->controller->layout = false; } - $this->_columnSelectorEnabled = $request->post($this->colSelFlagParam, $this->_columnSelectorEnabled); + $this->_columnSelectorEnabled = $request instanceof \yii\web\Request ? + $request->post($this->colSelFlagParam, $this->_columnSelectorEnabled) : + $this->_columnSelectorEnabled; $this->initSelectedColumns(); } if ($this->dynagrid) {