Re: Paginator sort field and direction indicator?

2009-10-14 Thread nMac
Guys,

below what I did. I think this is better than all the alternatives:




 'Date',
'Smr.status' => 'Status',
'Smr.title' => 'Title'
);

foreach($fields as $field => $title){
?>
sort($title, $field,
array('class' => ($field == $paginator->sortKey() ? $paginator->sortDir() :
'none')));?>



CSS:

table.listingTable th a.none{
background-image: url(/img/icons/arrow_collapse_light.png);
}

table.listingTable th a.asc{
background-image:url(/img/icons/arrow_expand_dark.png);
}

table.listingTable th a.desc{
background-image:url(/img/icons/arrow_collapse_dark.png);
}



Happy coding!





Nicolás Andrade
*n...@nicoandra.com.ar*
 Blog  | CV  |
Flickr  |
Del.icio.us|
LastFM 



On Sun, Jan 11, 2009 at 4:40 PM, DanielMedia wrote:

>
> Thanks for the help but that didn't seem to work. I ended up just
> hacking it by writing a custom function:
>
>  function check_sort($paginator, $sort_field){
>if($paginator->sortKey() == $sort_field){
>return ' class="' . $paginator->sortDir() . '"';
>}
> }
> ?>
>
> 
>> >sort('Time of Trade', 'Trade.time_of_trade'); ?>
>> $paginator->sort('Security Description',
> 'Trade.security_description'); ?>
>> >sort('Maturity Date', 'Trade.maturity_date'); ?>
>>sort
> ('Interest Rate', 'Trade.coupon'); ?>
>> $paginator->sort
> ('Price', 'Trade.dollar_price'); ?>
>>sort
> ('Yield', 'Trade.yield'); ?>
>>sort
> ('Trade Amount', 'Trade.par_traded'); ?>
> 
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Paginator sort field and direction indicator?

2009-01-11 Thread DanielMedia

Thanks for the help but that didn't seem to work. I ended up just
hacking it by writing a custom function:

sortKey() == $sort_field){
return ' class="' . $paginator->sortDir() . '"';
}
}
?>


>sort('Time of Trade', 'Trade.time_of_trade'); ?>
>sort('Security Description',
'Trade.security_description'); ?>
>sort('Maturity Date', 'Trade.maturity_date'); ?>
>sort
('Interest Rate', 'Trade.coupon'); ?>
>sort
('Price', 'Trade.dollar_price'); ?>
>sort
('Yield', 'Trade.yield'); ?>
>sort
('Trade Amount', 'Trade.par_traded'); ?>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Paginator sort field and direction indicator?

2009-01-10 Thread ianh

On Jan 10, 12:15 am, DanielMedia  wrote:
> I'm working on a project where a I have to display financial data. For
> instance, a table for stock trades might have 30 columns of data. So
> the client says, "Wow, that sorting feature works great, (Thanks Cake)
> but can we put a little arrow as an indicator as to which field is
> being sorted and what direction?". "No problem" I said. So I checked
> out the docs, and then the google group. The only thing that came
> close was this post:
>
> http://groups.google.com/group/cake-php/browse_thread/thread/fb8b10a1...
>
> So is that the only option? A giant switch statement?

http://blog.awpny.com/2008/04/cakephp-12-pagination-note/ about half
way down the page is a more simple option. Not yet tested it as only
discovered it yesterday but will be trying it out on Monday.

Ianh
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to 
cake-php+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---