yii\grid\GridView::renderItems PHP Méthode

renderItems() public méthode

Renders the data models for the grid view.
public renderItems ( )
    public function renderItems()
    {
        $caption = $this->renderCaption();
        $columnGroup = $this->renderColumnGroup();
        $tableHeader = $this->showHeader ? $this->renderTableHeader() : false;
        $tableBody = $this->renderTableBody();
        $tableFooter = $this->showFooter ? $this->renderTableFooter() : false;
        $content = array_filter([$caption, $columnGroup, $tableHeader, $tableFooter, $tableBody]);
        return Html::tag('table', implode("\n", $content), $this->tableOptions);
    }

Usage Example

 /**
  * 
  * I overrode it for making header and body separately
  * 
  */
 public function renderItems()
 {
     if (!$this->fixedHeader) {
         return parent::renderItems();
     }
     $content = array_filter([$this->renderCaption(), $this->renderColumnGroup(), $this->showHeader ? $this->renderTableHeader() : false]);
     $header = Html::tag('table', implode("\n", $content), $this->tableOptions);
     $content = array_filter([$this->renderCaption(), $this->renderColumnGroup(), $this->showFooter ? $this->renderTableFooter() : false, $this->renderTableBody()]);
     $body = Html::tag('table', implode("\n", $content), $this->tableOptions2 ?: $this->tableOptions);
     return strtr($this->fixedHeaderTemplate, ['{header}' => $header, '{body}' => $body]);
 }
All Usage Examples Of yii\grid\GridView::renderItems