Commit 3705f177 by Ivan Kolmycheck

Issue #3154 - GridView - list of filter model validation errors added to summary

parent c57e1fcb
......@@ -212,7 +212,34 @@ class GridView extends BaseListView
$view->registerJs("jQuery('#$id').yiiGridView($options);");
parent::run();
}
/**
* Renders the list of filterModel errors
*/
public function renderErrorsList()
{
if ($this->filterModel instanceof Model && $this->filterModel->hasErrors())
{
$errorsList = [];
foreach($this->filterModel->errors as $attribute => $errors)
{
$errorsList = ArrayHelper::merge($errorsList, $errors);
}
return Html::tag('div', Html::ul($errorsList, ['class' => 'help-block']), ['class' => 'has-error']);
}
return '';
}
/**
* @inheritdoc
*/
public function renderSummary()
{
$summary = parent::renderSummary();
$errorsList = $this->renderErrorsList();
return $summary . $errorsList;
}
/**
* Returns the options for the grid view JS widget.
* @return array the options
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment