Ejemplo n.º 1
0
 /**
  * Renders the filter cell content.
  * The default implementation simply renders a space.
  * This method may be overridden to customize the rendering of the filter cell (if any).
  * @return string the rendering result
  */
 protected function renderFilterCellContent()
 {
     if (is_string($this->filter)) {
         return $this->filter;
     }
     $model = $this->grid->filterModel;
     if ($this->filter !== false && $model instanceof Model && $this->attribute !== null && $model->isAttributeActive($this->attribute)) {
         if ($model->hasErrors($this->attribute)) {
             Html::addCssClass($this->filterOptions, 'has-error');
             $error = ' ' . Html::error($model, $this->attribute, $this->grid->filterErrorOptions);
         } else {
             $error = '';
         }
         return Html::activeTextInput($model, $this->attribute, $this->filterInputOptions) . $error;
     } else {
         return parent::renderFilterCellContent();
     }
 }