As you can sort by multiple fields, it should be .sort([(fieldname,
order)]) you miss a [ ]

On Mon, Oct 17, 2016 at 6:32 PM, Ferdinand Holzner <
ferdinandholz...@gmail.com> wrote:

> Hi,
>
> i'm trying to figure out how to implement sorting into the DataGrid using
> MongoDB with ming.
>
> Basically i took the example in the DataGrid documentation and tried to
> change it for Ming.
>
> ordering = kw.get('ordercol')
>
> if ordering and ordering[0] == '+':
>     places = places.sort(ordering[1:], ming.DESCENDING) # Descending
>
> elif ordering and ordering[0] == '-':
>     places = places.sort(ordering[1:], ming.ASCENDING) # Ascending
>
> But for some reason it doesn't work. It crashes with the following error
> message:
>
> TypeError: must use keyword argument for key function
>
>
>
> I also tried to enter the keyword instead of "ordering[1:]", but i get the
> same error. Any idea what's wrong?
>
> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to turbogears+unsubscr...@googlegroups.com.
> To post to this group, send email to turbogears@googlegroups.com.
> Visit this group at https://groups.google.com/group/turbogears.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to turbogears+unsubscr...@googlegroups.com.
To post to this group, send email to turbogears@googlegroups.com.
Visit this group at https://groups.google.com/group/turbogears.
For more options, visit https://groups.google.com/d/optout.

Reply via email to