Re: Re: Datagrid - addcolumn()

From: Date: Tue, 23 May 2006 18:21:16 +0000
Subject: Re: Re: Datagrid - addcolumn()
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-24132@lists.php.net to get a copy of this message
Toppi, Toppi wrote:
Mark Wiesemann schrieb:
You need to use a 'formatter'. Please refer to this example: http://pear.php.net/manual/en/package.structures.structures-datagrid.example-advanced.php In the formatter function you can do a print_r($params) to get an idea of what $params contains. Of course, the value you need, is in there.
Okay - that was quite straightforward, but there are still 2 problems left. 1) I need $record['id'], but as i am not displaying it ($datagridOptions["fields"] = array ("column1", "column2", "column3");) i cant access it. how may i access a column which isn't displayed?
In the current design, this is not possible when using the "fields" and "generate_columns" options. IMO this is a sort of bug.
2) How may i control where adcolumn() adds the column? i want it as the last column, but it is always appended as the first.
Normally, if you want it last you need to call addColumn() after bind(). But because of problem 1), I'm afraid you're obliged to forget about the 'generate_columns', 'fields' and 'labels' options. Calling addColumn() after bind() is just not going to be enough here. So : ignore these three options, and explicitly create all of your columns with addColumn(), as it is done in the manual page Mark mentionned above. You can of course create columns without formatter, and addColumn() is also where to set the labels. Check the Column constructor doc : http://pear.php.net/manual/en/package.structures.structures_datagrid.structures_datagrid_column.structures_datagrid_column.php -- og

« previous php.pear.general (#24132) next »