本文整理汇总了PHP中yii\grid\GridView::renderTableHeader方法的典型用法代码示例。如果您正苦于以下问题:PHP GridView::renderTableHeader方法的具体用法?PHP GridView::renderTableHeader怎么用?PHP GridView::renderTableHeader使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yii\grid\GridView
的用法示例。
在下文中一共展示了GridView::renderTableHeader方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderTableHeader
/**
* @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";
}
示例2: renderTableHeader
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();
}
}
示例3: renderTableHeader
/**
* 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>";
}
}
示例4: renderTableHeader
/**
* 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>"]);
}