Structures_DataGrid::addColumn()
-- カラムを追加する。オプションでその位置を指定する
パラメータ
- string
$position
"last"、"first"、"after" あるいは
"before" のいずれか (デフォルト:
"last")。
- string
$relativeTo
基準となるカラムの名前 (ラベル) あるいはフィールド名。
$position が "after" あるいは
"before" の場合に使用します。
- object
$column
Structures_DataGrid_Column オブジェクトへの参照。
返り値
失敗した場合に PEAR_Error を返します。それ以外の場合は値を返しません。
例
例 62-1シンプルなカラムの追加
<?php
$datagrid =& new Structures_DataGrid();
$column = new Structures_DataGrid_Column('Title', 'title', 'title', array('align' => 'center'), 'N/A', null);
$datagrid->addColumn($column);
?>
|
|
注意
この関数は、スタティックにコールする
ことはできません。
constructor
Structures_DataGrid:: Structures_DataGrid
(Previous)
|
(Next)
Structures_DataGrid::attachRenderer
|
|
|
Download Documentation
|
Last updated: Sun, 05 Oct 2008 |
|
Do you think that something on this page is wrong? Please file a bug report or add a note.
|
| User Notes: |
Note by: pierre2543@hotmail.com
If you are binding with a datasource and also want to add a column, make sure you call generateColumns() prior to adding your custom column. If you don't, none of the columns from the datasource will appear in your output.
Here's an example:
$dataobject = new DO_Task();
$datagrid =& new Structures_DataGrid(10);
$datagrid->bind($dataobject);
$datagrid->generateColumns(); //important!!
$datagrid->addColumn(new Structures_DataGrid_Column(
'Actions',
null,
null,
null,
null,
array('actionColumnCallback'),
'last'
));
$output = $datagrid->getOutput();
// Print rendering error if any
if (PEAR::isError($output))
echo $output->getMessage();
else
echo $output;
|
|