In your view in the header cell:

<th><?php echo 
link_to(image_tag('sort_icon.png'),'module/action?sort=column_name')
?> </th>

In your action:

$this->data = TablePeer::getData($parameters, $request->getParameter('sort'));

In your model for class TablePeer:

public static function getData($parameters, $sort_by)
{
  $c = new Criteria();
  //Set all criteria that needs setting
  $c->addAscendingOrderByColumn(self::$sort_by);
  $results = self::doSelect($c);

  return $results;
}


see? Easy! :)
On Thu, Mar 4, 2010 at 5:46 PM, ziclo <[email protected]> wrote:
> Does anyone has a tutorial about that ? The backend is usefull but a
> good tutorial would be appreciate in order to be able to do that kind
> of common functionnalities.
>
> Tnak you
>
> On 18 fév, 11:16, ziclo <[email protected]> wrote:
>> Hello,
>>
>> That what i'm going to do. Thank you
>>
>> On 18 fév, 09:12, Gareth McCumskey <[email protected]> wrote:
>>
>> > Why not just implement it yourself? You don't need to have everything
>> > pre-written for it. Simply make the column heading a link pointing to
>> > an action that re-runs the query with the correct ORDER BY sql in
>> > it....
>>
>> > On Sat, Feb 13, 2010 at 3:55 PM, ziclo <[email protected]> wrote:
>> > > Hi,
>>
>> > > I would like to be able to sort (order by ASC ou DESC) by clicking on
>> > > a colon title (th). The same way as the backend of the jobeet
>> > > tutorial.
>> > > I don't want it on the backend but on the frontend.
>>
>> > > With doctrine i can use the pager without difficulties but i do not
>> > > know how to sort a list (result of a query) by a simple click on the
>> > > title of a colonn.
>>
>> > > Does a tutorial exists about that ?
>>
>> > > Thank you.
>>
>> > > Ziclo
>>
>> > > --
>> > > You received this message because you are subscribed to the Google 
>> > > Groups "symfony users" group.
>> > > To post to this group, send email to [email protected].
>> > > To unsubscribe from this group, send email to 
>> > > [email protected].
>> > > For more options, visit this group 
>> > > athttp://groups.google.com/group/symfony-users?hl=en.
>>
>> > --
>> > Gareth McCumskeyhttp://garethmccumskey.blogspot.com
>> > twitter: @garethmcc
>
> --
> If you want to report a vulnerability issue on symfony, please send it to 
> security at symfony-project.com
>
> You received this message because you are subscribed to the Google
> Groups "symfony users" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/symfony-users?hl=en
>



-- 
Gareth McCumskey
http://garethmccumskey.blogspot.com
twitter: @garethmcc

-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en

Reply via email to