Re: One more question: hidden datagrid columns
| From: | Olivier Guilyardi | Date: | Sun, 08 Jun 2008 12:20:06 +0000 |
| Subject: | Re: One more question: hidden datagrid columns | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-28992@lists.php.net to get a copy of this message | ||
Bernhard Harb a écrit :
I use structure_datagrid with MDB2 and smarty to print the data on the screen. Everythings works fine, but there is one thing I have no solution at the moment: Is there a way to tell the datagrid, that a column should not be printet, but it's content should be available? For example, I need the ID of each record in every line because of links added to each lines output. I there a way that I can get each lines ID without showing it directly in datagrid?Yes, you can do that, by setting columns up before bind(), using either generateColumns() or addColumn(). If you don't, SDG automatically generates all columns it finds in the datasource. Example, to fetch id but hide it: $datagrid->generateColumns('name' => 'Name', 'phone' => 'Phone number'); $datagrid->bind('SELECT id, name, phone FROM addressbook'); You may also use removeColumn() after bind() to drop some column. Regards, -- Olivier