Re: One more question: hidden datagrid columns
| From: | Olivier Guilyardi | Date: | Sun, 08 Jun 2008 19:52:49 +0000 |
| Subject: | Re: One more question: hidden datagrid columns | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-28997@lists.php.net to get a copy of this message | ||
Bernhard Harb a écrit :
There's a cleaner way, with the 'associative' option of the smarty renderer. You can enable it with: $datagrid->fill($smarty, array('associative' => true)); Then in your smarty template, you can access $columnSet.id, $columnSet.username, etc... as well as $recordSet[0].id, $recordSet[0].username, etc... Do not hide columns by using generateColumns(), addColumn() or removeColumn(). Just fetch all fields with bind(), and in your template display the ones you want, use some fields to build links, etc... Regards, -- OlivierOk, I got a way how to manage it. I added each column I want to access but I do not want to show at the end of the column list and then I do a $datagrid->fill($smarty) In my Smarty template I do a {foreach} on every row and column and then I check the columncounter inside each row and only print the column if it is less then a specific value. Of course, thats not the best way but I think it's the only way to separate logic code and presentation code.Thanks a lot! Any idea, if there is a chance to get the value of a hidden column with smarty renderer? I think smarty gets only the visible columns - does it?