本文整理汇总了PHP中yii\grid\GridView::renderTableBody方法的典型用法代码示例。如果您正苦于以下问题:PHP GridView::renderTableBody方法的具体用法?PHP GridView::renderTableBody怎么用?PHP GridView::renderTableBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\grid\GridView
的用法示例。
在下文中一共展示了GridView::renderTableBody方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderTableBody
/**
* @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: renderTableBody
/**
* Renders the table body.
*
* @return string the rendering result.
*/
public function renderTableBody()
{
$content = parent::renderTableBody();
if ($this->showPageSummary) {
return $content . $this->renderPageSummary();
}
return $content;
}
示例3: renderTableBody
/**
* @inheritdoc
*/
public function renderTableBody()
{
if (!empty($this->mergeColumns) || !empty($this->extraRowColumns)) {
$this->groupColumns();
}
return parent::renderTableBody();
}
示例4: renderSinglePage
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: renderTableBody
/**
* Overide parent::run().
*/
public function renderTableBody()
{
if ($this->dataProvider != null) {
return parent::renderTableBody();
}
}