Commit bb4e8eb7 by Ivan Kolmycheck

DataColumn - error detection moved into renderFilterCellContent()

parent cd1152ac
......@@ -143,6 +143,9 @@ class DataColumn extends Column
return $this->filter;
} elseif ($this->filter !== false && $this->grid->filterModel instanceof Model &&
$this->attribute !== null && $this->grid->filterModel->isAttributeActive($this->attribute)) {
if ($this->grid->filterModel->hasErrors($this->attribute)) {
Html::addCssClass($this->filterOptions, 'has-error');
}
if (is_array($this->filter)) {
$options = array_merge(['prompt' => ''], $this->filterInputOptions);
return Html::activeDropDownList($this->grid->filterModel, $this->attribute, $this->filter, $options);
......@@ -182,28 +185,4 @@ class DataColumn extends Column
return parent::renderDataCellContent($model, $key, $index);
}
}
/**
* Checks for filter errors and sets up an indication if there are any
*/
public function checkForFilterErrors()
{
if ($this->filter !== false &&
$this->grid->filterModel instanceof Model &&
$this->attribute !== null &&
$this->grid->filterModel->isAttributeActive($this->attribute) &&
ArrayHelper::keyExists($this->attribute, $this->grid->filterModel->errors)
) {
Html::addCssClass($this->filterOptions, 'has-error');
}
}
/**
* @inheritdoc
*/
public function renderFilterCell()
{
$this->checkForFilterErrors();
return parent::renderFilterCell();
}
}
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