yii\grid\Column::renderHeaderCellContent PHP Method

renderHeaderCellContent() protected method

The default implementation simply renders [[header]]. This method may be overridden to customize the rendering of the header cell.
protected renderHeaderCellContent ( ) : string
return string the rendering result
    protected function renderHeaderCellContent()
    {
        return trim($this->header) !== '' ? $this->header : $this->getHeaderCellLabel();
    }

Usage Example

 /**
  * Renders the header cell content.
  * The default implementation simply renders [[header]].
  * This method may be overridden to customize the rendering of the header cell.
  * @return string the rendering result
  */
 protected function renderHeaderCellContent()
 {
     $name = rtrim($this->name, '[]') . '_all';
     $id = $this->grid->options['id'];
     $options = json_encode(['name' => $this->name, 'multiple' => $this->multiple, 'checkAll' => $name]);
     $this->grid->getView()->registerJs("jQuery('#{$id}').yiiGridView('setSelectionColumn', {$options});");
     if ($this->header !== null || !$this->multiple) {
         return parent::renderHeaderCellContent();
     } else {
         return Html::checkBox($name, false, ['class' => 'select-on-check-all']);
     }
 }
All Usage Examples Of yii\grid\Column::renderHeaderCellContent