Re: One more question: hidden datagrid columns

From: Date: Mon, 09 Jun 2008 10:43:23 +0000
Subject: Re: One more question: hidden datagrid columns
References: 1 2 3 4 5 6  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-28999@lists.php.net to get a copy of this message
On Sun, 08 Jun 2008 21:52:49 +0200, Olivier Guilyardi <olivierg@php.net> wrote: > Bernhard Harb a écrit : > >>>> 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? >>> >> Ok, 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. > > 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, > > -- > Olivier > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php Ah, thats nice - thanks for the hint. One last question for the moment: Is there any documentation about using DataGrid filters with Smarty. That means, is there a renderer for those filters for Smarty and which Smarty variables are set for use in the template file? Thanks, Bernhard.

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