本文整理汇总了PHP中DataGrid::getRows方法的典型用法代码示例。如果您正苦于以下问题:PHP DataGrid::getRows方法的具体用法?PHP DataGrid::getRows怎么用?PHP DataGrid::getRows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataGrid
的用法示例。
在下文中一共展示了DataGrid::getRows方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderBody
/**
* Renders data grid body.
* @return string
*/
public function renderBody()
{
$container = $this->getWrapper('datagrid container');
// headers
$header = Html::el($container->getName() == 'table' ? 'thead' : NULL);
$header->add($this->generateHeaderRow());
if ($this->dataGrid->hasFilters()) {
$header->add($this->generateFilterRow());
}
// footer
$footer = Html::el($container->getName() == 'table' ? 'tfoot' : NULL);
$footer->add($this->generateFooterRow());
// body
$body = Html::el($container->getName() == 'table' ? 'tbody' : NULL);
$iterator = new SmartCachingIterator($this->dataGrid->getRows());
foreach ($iterator as $data) {
$row = $this->generateContentRow($data);
$row->addClass($iterator->isEven() ? $this->getValue('row.content .even') : NULL);
$body->add($row);
}
if ($container->getName() == 'table') {
$container->add($header);
$container->add($footer);
$container->add($body);
} else {
$container->add($header);
$container->add($body);
$container->add($footer);
}
return $container->render(0);
}
示例2: renderBody
/**
* Renders data grid body.
* @return string
*/
public function renderBody()
{
$table = $this->getWrapper('datagrid container');
// headers
$table->add($this->generateHeaderRow());
// filters
if ($this->dataGrid->hasFilters()) {
$table->add($this->generateFilterRow());
}
// rows
$iterator = new \Nette\SmartCachingIterator($this->dataGrid->getRows());
foreach ($iterator as $data) {
$row = $this->generateContentRow($data);
$row->class[] = $iterator->isEven() ? $this->getValue('row.content .even') : '';
$table->add($row);
}
// footer
$table->add($this->generateFooterRow());
return $table->render(0);
}