Skip to content

Commit

Permalink
Add exportColumns to config
Browse files Browse the repository at this point in the history
  • Loading branch information
Eremin Michael committed Aug 13, 2018
1 parent 68f8c06 commit f24984d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion components/Crud.php
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,7 @@ public function export(CrudExportForm $model)
'renderData' => (bool)$model->renderData,
'model' => $this->getModel('search'),
'dataProvider' => $this->getDataProvider(),
'columns' => $this->guessColumns($this->getFields()),
'columns' => $this->getConfig('exportColumns', $this->guessColumns($this->getFields())),
]);
return $exporter->export();
}
Expand Down
5 changes: 5 additions & 0 deletions components/CrudImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use Yii;
use yii\base\BaseObject;
use yii\db\Schema;
use yii\helpers\ArrayHelper;

/**
* Class CrudImport
Expand Down Expand Up @@ -108,6 +109,10 @@ public function import()

/* @var $model \yii\db\ActiveRecord */
$model = new $this->modelClass;
if ($id = ArrayHelper::getValue($values, 'id')) {
$model->id = $id;
$model->setIsNewRecord(false);
}
$model->setAttributes($values);

if ($model->save()) {
Expand Down

0 comments on commit f24984d

Please sign in to comment.