renderTableHeader() public method

Renders the table header.
public renderTableHeader ( ) : string
return string the rendering result.
Beispiel #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";
 }
Beispiel #2
0
 public function renderTableHeader()
 {
     if ($this->customHeader) {
         $cells = [];
         foreach ($this->columns as $column) {
             $cells[] = $column->renderHeaderCell();
         }
         $content = preg_replace_callback('/\\{column([0-9]+)\\}/Sui', function ($m) use($cells) {
             $index = $m[1] - 1;
             return isset($cells[$index]) ? $cells[$index] : '';
         }, $this->customHeader);
         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>";
     } else {
         return parent::renderTableHeader();
     }
 }
Beispiel #3
0
 /**
  * Overide parent::run().
  */
 public function renderTableHeader()
 {
     if ($this->dataProvider != null) {
         return parent::renderTableHeader();
     } else {
         $content = [];
         foreach ($this->attrColumnsHeader as $column) {
             if (is_string($column)) {
                 $content[] = Html::tag('th', $column, $this->headerRowOptions);
             } else {
                 if (isset($column['class']) && $column['class'] == 'yii\\grid\\SerialColumn') {
                     $content[] = Html::tag('th', '#', $this->headerRowOptions);
                 }
             }
         }
         $content = Html::tag('tr', implode('', $content), $this->headerRowOptions);
         return "<thead>\n" . $content . "\n</thead>";
     }
 }
Beispiel #4
0
 /**
  * Renders the table header.
  *
  * @return string the rendering result.
  */
 public function renderTableHeader()
 {
     $content = parent::renderTableHeader();
     return strtr($content, ['<thead>' => "<thead>\n" . $this->generateRows($this->beforeHeader), '</thead>' => $this->generateRows($this->afterHeader) . "\n</thead>"]);
 }