renderTableBody() public method

Renders the table body.
public renderTableBody ( ) : string
return string the rendering result.
示例#1
0
文件: GridView.php 项目: h11Nox/slug
 /**
  * @inheritdoc
  * @return string the rendering result.
  */
 public function renderTableBody()
 {
     if (!$this->showHeader) {
         return parent::renderTableBody();
     }
     $models = array_values($this->dataProvider->getModels());
     $keys = $this->dataProvider->getKeys();
     $rows = [];
     foreach ($models as $index => $model) {
         $key = $keys[$index];
         if ($this->beforeRow !== null) {
             $row = call_user_func($this->beforeRow, $model, $key, $index, $this);
             if (!empty($row)) {
                 $rows[] = $row;
             }
         }
         $rows[] = $this->renderTableRow($model, $key, $index);
         if ($this->afterRow !== null) {
             $row = call_user_func($this->afterRow, $model, $key, $index, $this);
             if (!empty($row)) {
                 $rows[] = $row;
             }
         }
     }
     if (empty($rows)) {
         $colspan = count($this->columns);
         return "\n<tr><td colspan=\"{$colspan}\">" . $this->renderEmpty() . "</td></tr>\n</tbody>";
     } else {
         return "\n" . implode("\n", $rows) . "\n</tbody>";
     }
 }
示例#2
0
 /**
  * Renders the table body.
  *
  * @return string the rendering result.
  */
 public function renderTableBody()
 {
     $content = parent::renderTableBody();
     if ($this->showPageSummary) {
         return $content . $this->renderPageSummary();
     }
     return $content;
 }
 /**
  * @inheritdoc
  */
 public function renderTableBody()
 {
     if (!empty($this->mergeColumns) || !empty($this->extraRowColumns)) {
         $this->groupColumns();
     }
     return parent::renderTableBody();
 }
示例#4
0
 protected function renderSinglePage($page)
 {
     $this->dataProvider->getPagination()->page = $page;
     $this->dataProvider->prepare(true);
     $pageContent = parent::renderTableBody();
     $pageContent = str_replace('<tbody>', '', $pageContent);
     $pageContent = str_replace('</tbody>', '', $pageContent);
     return $pageContent;
 }
示例#5
0
 /**
  * Overide parent::run().
  */
 public function renderTableBody()
 {
     if ($this->dataProvider != null) {
         return parent::renderTableBody();
     }
 }