本文整理匯總了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();
}
}