本文整理汇总了PHP中DataGrid::addColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP DataGrid::addColumn方法的具体用法?PHP DataGrid::addColumn怎么用?PHP DataGrid::addColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataGrid
的用法示例。
在下文中一共展示了DataGrid::addColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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;
}
示例3: createComponentUsers
protected function createComponentUsers()
{
$grid = new DataGrid();
$grid->bindDataTable(UsersModel::getUsers());
$grid->addColumn('userName', 'Uživatelské jméno')->addFilter();
$grid->addColumn('firstName', 'Jméno')->addFilter();
$grid->addColumn('surname', 'Přijmení')->addFilter();
$grid->addColumn('email', 'E-mail')->addFilter();
$grid->addColumn('icq', 'ICQ')->addFilter();
$grid->addColumn('mobile', 'Mobilní telefon')->addFilter();
$grid->addColumn('active', 'Aktivní')->addSelectboxFilter(array(1 => 'Yes', 0 => 'No'));
$grid->addColumn('holiday', 'Dovolená')->addSelectboxFilter(array(1 => 'Yes', 0 => 'No'));
$grid->multiOrder = FALSE;
// order by one column only
$grid['holiday']->replacement['1'] = 'Ano';
$grid['holiday']->replacement['0'] = 'Ne';
$grid['active']->replacement['1'] = 'Ano';
$grid['active']->replacement['0'] = 'Ne';
$grid->displayedItems = array(10, 20, 50, 75, 100, 500, 1000);
// roletka pro výběr počtu řádků na stránku
$grid->addActionColumn('Actions');
$grid->keyName = 'id';
$grid->addAction('Aktivovat/Deaktivovat', 'userActivateChange!', Html::el('span')->setText('Aktivace/Deaktivace'), $useAjax = TRUE);
$grid->addAction('Dovolená', 'userHolidayChange!', Html::el('span')->setText('Dovolená'), $useAjax = TRUE);
$grid->addAction('Editovat', 'userChangeRedirect', Html::el('span')->setText('Editovat'), $useAjax = FALSE);
$grid->addAction('Změnit heslo', 'userPasswordChangeRedirect', Html::el('span')->setText('Změnit heslo'), $useAjax = FALSE);
$grid->addAction('Smazat', 'confirmForm:confirmUserDelete!', Html::el('span')->setText('Smazat'), $useAjax = TRUE);
return $grid;
}
示例4: 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);
}
示例5: 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;
}
示例6: createComponentCategoriesGrid
public function createComponentCategoriesGrid($name)
{
$grid = new DataGrid($this, $name);
$ds = $this->model('categories')->getDs();
$grid->bindDataTable($ds);
$grid->keyName = 'id';
$grid->addColumn('title', 'Title')->addFilter();
$grid->addActionColumn('Actions');
$grid->addAction('Edit', 'editCategory!', Html::el('span')->class('icon icon-edit'), $useAjax = TRUE);
$grid->addAction('Delete', 'confirmForm:confirmDelete!', Html::el('span')->class('icon icon-delete'), $useAjax = TRUE);
return $grid;
}
示例7: 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;
}
示例8: createComponentGrid
public function createComponentGrid($name)
{
$grid = new DataGrid($this, $name);
$ds = $this->model('menu')->getDs();
$grid->bindDataTable($ds);
$grid->keyName = 'id';
$grid->addColumn('name', 'Name')->addTextFilter();
$grid['name']->formatCallback[] = array($this, 'createNameLink');
// přidáme sloupec pro akce
$grid->addActionColumn('Actions');
// a naplníme datagrid akcemi pomocí továrničky
$grid->addAction('Items', 'MenuItems:default', Html::el('span')->class('icon icon-items'), $useAjax = true);
$grid->addAction('Edit', 'editMenu!', Html::el('span')->class('icon icon-edit'), $useAjax = true);
$grid->addAction('Delete', 'confirmForm:confirmDelete!', Html::el('span')->class('icon icon-delete'), $useAjax = true);
return $grid;
}
示例9: 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);
}
示例10: createComponentStudentsGrid
public function createComponentStudentsGrid($name)
{
$grid = new DataGrid($this, $name);
$examStudentList = ExamStudentListManager::getList($this->exam_id);
$grid->bindDataTable($examStudentList->dataSource);
$grid->addNumericColumn('id', 'Num');
$pos = 0;
$grid['id']->formatCallback[] = function ($value, DibiRow $data) use(&$pos) {
return $pos = $pos + 1;
};
$grid->addColumn('name', 'Name');
$grid['name']->formatCallback[] = function ($value, DibiRow $data) {
return $data->surname . ' ' . $data->name;
};
return $grid;
}
示例11: isset
// validamos los parámetros que recibimos
$criterio = isset($_REQUEST['_criterio']) ? $_REQUEST['_criterio'] : '';
$page = isset($_REQUEST['_page']) ? $_REQUEST['_page'] : 1;
$regxpag = isset($_REQUEST['_regxpag']) ? $_REQUEST['_regxpag'] : 10;
$Grid->excel();
$Grid->pdf();
$Grid->addCheckBox(array("values" => array("apellidos", "nombres"), "ajax" => array("funcion" => "index.check", "params" => array("apellidos", "nombres")), "fnCallback" => function ($fila, $row) {
// se trata de un closure o función anónima, a la que accedemos por el indice (fnCallback)
if ($row['genero'] == 'M') {
$cadena = '<input type="checkbox" id="chk_gridT' . $fila . '" name="chk_gridT[]" disabled>';
} else {
$cadena = '<input type="checkbox" id="chk_gridT' . $fila . '" name="chk_gridT[]">';
}
return $cadena;
}));
$Grid->addColumn(array("title" => "Nombres", "campo" => "nombres"));
$Grid->addColumn(array("title" => "Apellidos", "campo" => "apellidos", "fnCallback" => function ($fila, $row) {
// se trata de un closure o función anónima, a la que accedemos por el indice (fnCallback)
$cadena = $row['nombres'] . ' - ' . $row['apellidos'];
return $cadena;
}));
$Grid->AddAccion(array("titulo" => "Editar", "icono" => "glyphicon glyphicon-pencil", "ajax" => array("funcion" => "index.edit", "params" => array("apellidos", "nombres")), "fnCallback" => function ($fila, $row) {
// se trata de un closure o función anónima, a la que accedemos por el indice (fnCallback)
$cadena = $fila . '.- ' . $row['nombres'] . ' - ' . $row['apellidos'];
return $cadena;
}));
$Grid->AddAccion(array("titulo" => "Editar", "icono" => "glyphicon glyphicon-pencil", "ajax" => array("funcion" => "index.edit", "params" => array("apellidos", "nombres"))));
$Grid->AddAccion(array("titulo" => "Editar", "icono" => "glyphicon glyphicon-pencil", "ajax" => array("funcion" => "index.edit", "params" => array("apellidos", "nombres"))));
$Grid->selectData(array("info" => true, "criterio" => $criterio, "class" => "ConsultarData", "method" => "getDataSP", "paginate" => array("ajax" => "index.getDatagrid", "page" => $page, "reg_x_pag" => $regxpag, "itemPaginas" => 10)));
echo $Grid->render();
/* Para comprobar la conexión
示例12:
"funcion"=>"index.check",
"params"=>array("apellidos","nombres")
),
"fnCallbak"=>function($fila,$row){
if($row['genero'] == 'M'){
$cadena = '<input type="checkbox" id="chk_gridT'.$fila.'" name="chk_gridT[]" disabled>';
}else{
$cadena = '<input type="checkbox" id="chk_gridT'.$fila.'" name="chk_gridT[]">';
}
return $cadena;
}
));
$Grid->addColumn(array(
"title"=>"Nombres",
"campo"=>"nombres"
));
$Grid->addColumn(array(
"title"=>"Apellidos",
"campo"=>"apellidos",
"fnCallbak"=>function($fila,$row){
$cadena = $row['nombres'].' - '.$row['apellidos'];
return $cadena;
}
));
$Grid->addAccion(array(
"titulo"=>"Editar",
"icono"=>"glyphicon glyphicon-pencil",
"ajax"=>array(
"funcion"=>"index.edit",
"params"=>array("apellidos","nombres")
示例13: createComponentOrdersGrid
protected function createComponentOrdersGrid()
{
$model = new DatagridModel();
$grid = new DataGrid();
$translator = new GettextTranslator(Environment::expand('%templatesDir%/customersGrid.cs.mo'));
$grid->setTranslator($translator);
$renderer = new DataGridRenderer();
$renderer->paginatorFormat = '%input%';
// customize format of paginator
$renderer->onCellRender[] = array($this, 'ordersGridOnCellRendered');
$grid->setRenderer($renderer);
$grid->itemsPerPage = 10;
// display 10 rows per page
$grid->displayedItems = array('all', 10, 20, 50);
// items per page selectbox items
$grid->rememberState = TRUE;
$grid->timeout = '+ 7 days';
// change session expiration after 7 days
$grid->bindDataTable($model->getOrdersInfo());
$grid->multiOrder = FALSE;
// order by one column only
$operations = array('delete' => 'delete', 'deal' => 'deal', 'print' => 'print', 'forward' => 'forward');
// define operations
// in czech for example: $operations = array('delete' => 'smazat', 'deal' => 'vyřídit', 'print' => 'tisk', 'forward' => 'předat');
// or you can left translate values by translator adapter
$callback = array($this, 'gridOperationHandler');
$grid->allowOperations($operations, $callback, 'orderNumber');
// allows checkboxes to do operations with more rows
/**** add some columns ****/
$grid->addColumn('customerName', 'Customer');
$grid->addColumn('addressLine1', 'Address')->getHeaderPrototype()->addStyle('width: 180px');
$grid->addColumn('city', 'City');
$grid->addColumn('country', 'Country');
$caption = Html::el('span')->setText('P')->title('Number of products on order')->class('link');
$grid->addNumericColumn('productsCount', $caption)->getCellPrototype()->addStyle('text-align: center');
$grid->addDateColumn('orderDate', 'Date', '%m/%d/%Y');
// czech format: '%d.%m.%Y'
$grid->addColumn('status', 'Status');
$grid->addColumn('creditLimit', 'Credit')->getCellPrototype()->addStyle('text-align: center');
/**** add some filters ****/
$grid['customerName']->addFilter();
$grid['addressLine1']->addFilter();
$grid['city']->addSelectboxFilter()->translateItems(FALSE);
$grid['country']->addSelectboxFilter()->translateItems(FALSE);
$grid['productsCount']->addFilter();
$grid['orderDate']->addDateFilter();
$grid['status']->addSelectboxFilter();
$grid['creditLimit']->addFilter();
/**** default sorting and filtering ****/
$grid['orderDate']->addDefaultSorting('desc');
$grid['productsCount']->addDefaultFiltering('>2');
/**** column content affecting ****/
// by css styling
$grid['orderDate']->getCellPrototype()->addStyle('text-align: center');
$grid['status']->getHeaderPrototype()->addStyle('width: 60px');
$grid['addressLine1']->getHeaderPrototype()->addStyle('width: 150px');
$grid['city']->getHeaderPrototype()->addStyle('width: 90px');
// by replacement of given pattern
$el = Html::el('span')->addStyle('margin: 0 auto');
$grid['status']->replacement['Shipped'] = clone $el->class("icon icon-shipped")->title("Shipped");
$grid['status']->replacement['Resolved'] = clone $el->class("icon icon-resolved")->title("Resolved");
$grid['status']->replacement['Cancelled'] = clone $el->class("icon icon-cancelled")->title("Cancelled");
$grid['status']->replacement['On Hold'] = clone $el->class("icon icon-hold")->title("On Hold");
$grid['status']->replacement['In Process'] = clone $el->class("icon icon-process")->title("In Process");
$grid['status']->replacement['Disputed'] = clone $el->class("icon icon-disputed")->title("Disputed");
$grid['status']->replacement[''] = clone $el->class("icon icon-no-orders")->title("Without orders");
// by callback(s)
$grid['creditLimit']->formatCallback[] = 'Helpers::currency';
/**** add some actions ****/
$grid->addActionColumn('Actions')->getHeaderPrototype()->addStyle('width: 98px');
$icon = Html::el('span');
$grid->addAction('Copy', 'Customer:copy', clone $icon->class('icon icon-copy'));
$grid->addAction('Detail', 'Customer:detail', clone $icon->class('icon icon-detail'));
$grid->addAction('Edit', 'Customer:edit', clone $icon->class('icon icon-edit'));
$grid->addAction('Delete', 'Customer:delete', clone $icon->class('icon icon-del'));
return $grid;
}
示例14: Button
$radioButtons->addOption('Waz', 'WAZ');
$vbox->packStart($radioButtons);
//$file = new FileEntry('archivo');
//$vbox->packStart($file);
$b = new Button('b1', 'Send', STOCK_CANCEL);
$b->addEvent(new JSEvent(ON_CLICK, 'this.form.submit()'));
$vbox->packStart($b);
$form = new Form($_SERVER['PHP_SELF'], 'post');
$form->add($vbox);
$form->show();
if (count($_POST) > 1) {
$data = array();
$i = 0;
foreach ($_POST as $k => $v) {
$data[$i]['name'] = $k;
if (is_array($v)) {
$data[$i]['value'] = implode('<br />', $v);
} else {
$data[$i]['value'] = $v;
}
$i++;
}
$grid = new DataGrid($data, 'Widgets/Values');
$grid->addColumn(new Column('Widget', 'name'));
$grid->addColumn(new Column('Value', 'value'));
$grid->show();
}
?>
</body>
</html>
示例15: createComponentDatagridRoles
public function createComponentDatagridRoles($name)
{
$grid = new DataGrid($this, $name);
$model = new UsersModuleModel();
$grid->bindDataTable($model->getRolesDs());
$grid->keyName = 'id';
$grid->addColumn('name', 'Name')->addFilter();
$grid->addActionColumn('Actions');
$grid->addAction('Permissions', 'editPermissions!', Html::el('span')->class('icon icon-edit'), $useAjax = TRUE);
$grid->addAction('Delete', 'confirmForm:confirmDelete!', Html::el('span')->class('icon icon-delete'), $useAjax = TRUE);
return $grid;
}