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