yii\grid\GridView::renderTableHeader PHP Method

renderTableHeader() public method

Renders the table header.
public renderTableHeader ( ) : string
return string the rendering result.
    public function renderTableHeader()
    {
        $cells = [];
        foreach ($this->columns as $column) {
            /* @var $column Column */
            $cells[] = $column->renderHeaderCell();
        }
        $content = Html::tag('tr', implode('', $cells), $this->headerRowOptions);
        if ($this->filterPosition === self::FILTER_POS_HEADER) {
            $content = $this->renderFilters() . $content;
        } elseif ($this->filterPosition === self::FILTER_POS_BODY) {
            $content .= $this->renderFilters();
        }
        return "<thead>\n" . $content . "\n</thead>";
    }

Usage Example

Example #1
0
 /**
  * @inheritdoc
  * @return string
  */
 public function renderTableHeader()
 {
     if (!$this->showHeader) {
         return parent::renderTableHeader();
     }
     $cells = [];
     foreach ($this->columns as $column) {
         /* @var $column Column */
         $cells[] = $column->renderHeaderCell();
     }
     $content = Html::tag('tr', implode('', $cells), $this->headerRowOptions);
     if ($this->filterPosition == self::FILTER_POS_HEADER) {
         $content = $this->renderFilters() . $content;
     } elseif ($this->filterPosition == self::FILTER_POS_BODY) {
         $content .= $this->renderFilters();
     }
     return "<tbody>\n" . $content . "\n";
 }
All Usage Examples Of yii\grid\GridView::renderTableHeader