本文整理汇总了PHP中DataGrid::getRenderer方法的典型用法代码示例。如果您正苦于以下问题:PHP DataGrid::getRenderer方法的具体用法?PHP DataGrid::getRenderer怎么用?PHP DataGrid::getRenderer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataGrid
的用法示例。
在下文中一共展示了DataGrid::getRenderer方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createComponentDataGrid
/**
* Component factory.
* @see Nette/ComponentContainer#createComponent()
*/
protected function createComponentDataGrid($name)
{
$grid = new DataGrid();
$grid->bindDataTable(dibi::getConnection()->dataSource('SELECT
authorId as id,
name,
surname,
class,', Model::sqlClassName(Model::getSchoolYear()) . 'as classMark,
(SELECT COUNT(workId) FROM [works] WHERE author=authorId) as sum
FROM [authors]
'));
$grid->addColumn('name', 'Jméno');
$grid->addColumn('surname', 'Příjmení')->addDefaultSorting('asc');
$grid->addColumn('class', 'Maturita')->getCellPrototype()->style('text-align: center;');
$grid->addColumn('classMark', 'Třída')->getCellPrototype()->style('text-align: right;');
$grid->addColumn('sum', 'Počet prací')->getCellPrototype()->style('text-align: right;')->class('pages');
$grid->addActionColumn('Akce');
$grid->keyName = 'id';
$grid->addAction('Smazat', 'delete!', NULL, FALSE, DataGridAction::WITH_KEY);
$grid['name']->addFilter();
$grid['surname']->addFilter();
$grid['class']->addSelectboxFilter();
$grid['classMark']->addSelectboxFilter();
$grid['sum']->addSelectboxFilter();
$grid->multiOrder = FALSE;
$grid->itemsPerPage = $this->getCookiesItemsCount(15);
$renderer = $grid->getRenderer();
$renderer->paginatorFormat = '%label% %input% z %count%';
$renderer->infoFormat = 'Autoři %from%. - %to%. z %count% | Zobrazit: %selectbox% | %reset%';
$renderer->onRowRender[] = array($this, 'OnRowRendered');
//$grid->rememberState = TRUE;
$this->addComponent($grid, $name);
return;
}
示例2: createComponentWorks
protected function createComponentWorks($name)
{
//url as link,
//title,
$grid = new DataGrid();
$grid->bindDataTable(dibi::getConnection()->dataSource('SELECT
url as link,
authorUrl,
title,
award,
year,', Model::sqlWorkClassName() . 'as workClass,', 'type,
pages,
[read]
FROM [works]
JOIN [authors] on author = authorId
WHERE authorUrl=%s', $this->id));
$grid->addColumn('title', 'Název')->addDefaultSorting('asc')->getCellPrototype()->addClass('first');
$grid->addNumericColumn('year', 'Rok')->getCellPrototype()->style('text-align: center;');
$grid->addColumn('workClass', 'Třída')->getCellPrototype()->style('text-align: center;');
$grid->addColumn('award', 'Ocenění');
$grid->addColumn('type', 'Typ');
$grid->addNumericColumn('pages', 'Stran')->getCellPrototype()->style('text-align: right');
$grid->addColumn('read', 'Čtenost')->getCellPrototype()->style('text-align: right;');
/*
$grid->addActionColumn('Akce');
$grid['title']->addFilter();
$grid['authorName']->addFilter();
$grid['year']->addSelectboxFilter();
$grid['award']->addSelectboxFilter();
$grid['type']->addSelectboxFilter();
$grid['pages']->addSelectboxFilter(); */
$grid->itemsPerPage = 0;
$grid->multiOrder = FALSE;
$renderer = $grid->getRenderer();
$renderer->paginatorFormat = '%label% %input% z %count%';
$renderer->infoFormat = 'Práce %from% - %to% z %count% | Zobrazit: %selectbox% | %reset%';
$renderer->onRowRender[] = array($this, 'worksOnRowRendered');
//$renderer->onCellRender[] = array($this, 'gridOnCellRendered');
//$grid->rememberState = TRUE;
return $grid;
//$this->addComponent($grid, $name);
}
示例3: createComponentModulesGrid
public function createComponentModulesGrid($name, $page)
{
$grid = new DataGrid($page, $name);
$grid->rememberState = TRUE;
// povolí ukládání stavů komponenty do session
$grid->timeout = '+ 7 days';
$ds = $this->model('Modules')->getDs();
$grid->bindDataTable($ds);
$grid->keyName = 'module_name';
$grid->addColumn('module_name', 'Name')->addFilter();
$grid->addColumn('status', 'Status')->addSelectboxFilter(array('enabled' => "Enabled", 'disabled' => "Disabled"), TRUE);
$grid->addActionColumn('Actions');
$grid->addAction('StatusToggle', 'changeStatus!', null, $useAjax = TRUE);
$grid->addAction('Delete', 'confirmForm:confirmDelete!', Html::el('span')->class('icon icon-explode'), $useAjax = TRUE);
$renderer = $grid->getRenderer();
$renderer->paginatorFormat = '%input%';
$renderer->onActionRender[] = array($this, 'formatActions');
$grid->setRenderer($renderer);
return $grid;
}
示例4: createComponentPagesGrid
public function createComponentPagesGrid($name)
{
$grid = new DataGrid($this, $name);
$grid->rememberState = TRUE;
// povolí ukládání stavů komponenty do session
$grid->timeout = '+ 7 days';
$ds = $this->model('Pages')->getDs();
$grid->bindDataTable($ds);
$grid->keyName = 'title';
$grid->addColumn('homepage', '');
$grid['homepage']->getHeaderPrototype()->class('homepage-column');
$grid['homepage']->getCellPrototype()->class('homepage-column');
$grid['homepage']->formatCallback[] = array($this, 'homepageCallback');
//$grid['creditLimit']->getCellPrototype()->style('text-align: center');
$grid->addColumn('title', 'Title')->addFilter();
$categories = $this->model('categories')->getPairs();
$grid->addColumn('category', 'Category')->addSelectboxFilter($categories);
$this->categories = array('0' => 'none') + $categories;
$grid['category']->formatCallback[] = array($this, 'gridCategoryCallback');
$grid['title']->formatCallback[] = array($this, 'createLink');
$grid->addColumn('template', 'Template')->addSelectboxFilter();
$grid['template']->getCellPrototype()->style('text-align: center');
$grid['template']->formatCallback[] = array($this, 'templateFormatCallback');
$grid->addColumn('published', 'Published')->addSelectboxFilter(array('0' => "No", '1' => "Yes"), TRUE);
$grid['published']->getCellPrototype()->style('text-align: center');
$grid['published']->formatCallback[] = array($this, 'publishFormatCallback');
$grid->addDateColumn('publish_time', 'Publish time', '%d.%m.%Y %H:%M:%S');
$grid['publish_time']->getHeaderPrototype()->style('text-align: center');
$grid['publish_time']->getCellPrototype()->style('text-align: center');
$grid->addActionColumn('Actions');
$grid->addAction('Edit', 'editPage!', Html::el('span')->class('icon icon-edit'), $useAjax = TRUE);
$grid->addAction('Delete', 'confirmForm:confirmDelete!', Html::el('span')->class('icon icon-delete'), $useAjax = TRUE);
$renderer = $grid->getRenderer();
$renderer->paginatorFormat = '%input%';
$grid->setRenderer($renderer);
return $grid;
}
示例5: createComponentAuthors
protected function createComponentAuthors($name)
{
$grid = new DataGrid();
$search = "";
if (isset($this->searchFull)) {
foreach ($this->search as $one) {
//$search .= "name LIKE '%".$one."%' OR surname LIKE '% ".$one."%' OR ";
$search .= "name RLIKE '(^| ){$one}' OR surname RLIKE '(^| ){$one}' OR ";
}
foreach ($this->searchFull as $one) {
$search .= "name RLIKE '(^| )" . $one . " ' OR surname RLIKE '(^| )" . $one . " ' OR ";
}
$search = substr($search, 0, -3);
}
$grid->bindDataTable(dibi::getConnection()->dataSource('SELECT
authorUrl as link,
name,
surname,', $this->formColumns(array('class')), Model::sqlClassName(Model::getSchoolYear()) . 'as classMark,', Model::sqlSumWorks() . 'as [sum],', Model::sqlSumReads() . 'as [read]', 'FROM [authors]', 'WHERE %and', $this->where, '%if', isset($search), 'AND %sql', $search, '%end'));
$grid->addColumn('name', 'Jméno')->getCellPrototype()->addClass('first');
$grid->addColumn('surname', 'Příjmení')->addDefaultSorting('asc');
if ($this->notCol('class')) {
$grid->addColumn('class', 'Maturita')->getCellPrototype()->style('text-align: center;');
}
$grid->addColumn('classMark', 'Třída')->getCellPrototype()->style('text-align: right;');
$grid->addColumn('sum', 'Počet prací')->getCellPrototype()->style('text-align: right;');
$grid->addColumn('read', 'Čtenost')->getCellPrototype()->style('text-align: right;');
$grid->multiOrder = FALSE;
$grid->displayedItems = array('vše', 5, 8, 10, 20, 50, 100);
$grid->itemsPerPage = $this->getCookiesItemsCount(8);
$grid->nothingMessage = "Žádný autor nebyl nalezen.";
$grid->hiddenFiltering = TRUE;
$renderer = $grid->getRenderer();
$renderer->paginatorFormat = '%label% %input% z %count%';
$renderer->infoFormat = 'Autoři %from% - %to% z %count% | Zobrazit: %selectbox% | %reset%';
$renderer->onRowRender[] = array($this, 'authorsOnRowRendered');
//$renderer->onCellRender[] = array($this, 'gridOnCellRendered');
return $grid;
//$this->addComponent($grid, $name);
}
示例6: createComponentDataGrid
/**
* Component factory.
* @see Nette/ComponentContainer#createComponent()
*/
protected function createComponentDataGrid($name)
{
$grid = new DataGrid();
$grid->bindDataTable(dibi::getConnection()->dataSource('SELECT
workId as id,
title,
CONCAT_WS(" ", name, surname) as authorName,
award,
year,
type,
pages,
added,
edited
FROM [works]
join [authors] on author = authorId', 'WHERE %and', $this->where));
$grid->addActionColumn('Akce');
$grid->addColumn('title', 'Název', 50)->addDefaultSorting('asc');
if (!isset($this->where['authorId'])) {
$grid->addColumn('authorName', 'Autor');
}
$grid->addNumericColumn('year', 'Ročník')->getCellPrototype()->style('min-width: 75px;');
$grid->addDateColumn('added', 'Vytvořena', '%d.%m.%Y');
$grid->addDateColumn('edited', 'Upravena', '%H:%M:%S %d.%m.%Y')->getCellPrototype()->style('white-space: nowrap;');
$grid->addColumn('award', 'Cena');
$grid->addColumn('type', 'Typ');
$grid->addNumericColumn('pages', 'Stran')->getCellPrototype()->style('text-align: right;')->class = 'pages';
$grid->keyName = 'id';
$grid->addAction('Smazat', 'delete!', NULL, FALSE, DataGridAction::WITH_KEY);
if ($this->advanced) {
$grid['title']->addFilter();
$grid['authorName']->addFilter();
$grid['year']->addSelectboxFilter();
$grid['award']->addSelectboxFilter();
$grid['type']->addSelectboxFilter();
$grid['type']->addSelectboxFilter();
$grid['added']->addDateFilter();
$grid['edited']->addDateFilter();
if (isset($grid['pages'])) {
$grid['pages']->addSelectboxFilter();
}
}
//$grid->itemsPerPage = ;
$grid->multiOrder = FALSE;
$grid->itemsPerPage = $this->getCookiesItemsCount(15);
$renderer = $grid->getRenderer();
$renderer->paginatorFormat = '%label% %input% z %count%';
$renderer->infoFormat = 'Práce %from% - %to% z %count% | Zobrazit: %selectbox% | %reset%';
$renderer->onRowRender[] = array($this, 'worksOnRowRendered');
if (!$grid->paginator->itemCount) {
$renderer->wrappers['form']['.class'] .= " hidden";
}
//$grid->rememberState = TRUE;
$this->addComponent($grid, $name);
return;
}