|
|
@ -59,14 +59,16 @@ class DataColumn extends Column |
|
|
|
|
|
|
|
|
|
|
|
protected function renderHeaderCellContent() |
|
|
|
protected function renderHeaderCellContent() |
|
|
|
{ |
|
|
|
{ |
|
|
|
if ($this->attribute !== null && $this->header === null) { |
|
|
|
$provider = $this->grid->dataProvider; |
|
|
|
$provider = $this->grid->dataProvider; |
|
|
|
if ($this->attribute !== null && $this->enableSorting && |
|
|
|
if ($this->enableSorting && ($sort = $provider->getSort()) !== false && $sort->hasAttribute($this->attribute)) { |
|
|
|
($sort = $provider->getSort()) !== false && $sort->hasAttribute($this->attribute)) { |
|
|
|
if (!isset($sort->attributes[$this->attribute]['label'])) { |
|
|
|
|
|
|
|
$sort->attributes[$this->attribute]['label'] = $this->getHeaderLabel(); |
|
|
|
$label = $this->getHeaderLabel(); |
|
|
|
} |
|
|
|
if (($this->header !== null || !isset($sort->attributes[$this->attribute]['label'])) && trim($label) !== '') { |
|
|
|
return $sort->link($this->attribute); |
|
|
|
$sort->attributes[$this->attribute]['label'] = $label; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return $sort->link($this->attribute); |
|
|
|
|
|
|
|
} elseif ($this->header === null) { |
|
|
|
return $this->getHeaderLabel(); |
|
|
|
return $this->getHeaderLabel(); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
return parent::renderHeaderCellContent(); |
|
|
|
return parent::renderHeaderCellContent(); |
|
|
@ -76,6 +78,9 @@ class DataColumn extends Column |
|
|
|
protected function getHeaderLabel() |
|
|
|
protected function getHeaderLabel() |
|
|
|
{ |
|
|
|
{ |
|
|
|
$provider = $this->grid->dataProvider; |
|
|
|
$provider = $this->grid->dataProvider; |
|
|
|
|
|
|
|
if ($this->header !== null) { |
|
|
|
|
|
|
|
return $this->header; |
|
|
|
|
|
|
|
} |
|
|
|
if ($provider instanceof ActiveDataProvider && $provider->query instanceof ActiveQuery) { |
|
|
|
if ($provider instanceof ActiveDataProvider && $provider->query instanceof ActiveQuery) { |
|
|
|
/** @var Model $model */ |
|
|
|
/** @var Model $model */ |
|
|
|
$model = new $provider->query->modelClass; |
|
|
|
$model = new $provider->query->modelClass; |
|
|
|