Dynamically Sorting a Projection

Topics: Core, Customizing Orchard, General, Troubleshooting, Writing modules, Writing themes
Jun 5, 2012 at 10:06 PM

I've looked around but can't seem to find an example of how one could dynamically sort a projection.  How would I give the user something to interact with on the front end of the site that would allow them to switch between asc/desc sort order for a particular field?

Developer
Jun 5, 2012 at 10:33 PM

Probably your best bet here is to take a look at tokens: through tokens you can  access request values too. However AFAIK sorting should be set on the admin UI, so maybe there's no way here without writing a sort provider.

Coordinator
Jun 5, 2012 at 10:37 PM

Tokens can get values from the query string, and you can use it today to change the filters. I was dumb enough to forget about sorting. Can you file a bug so that I take some time to think about a nice solution.

It might also interest the guys doing the Table Layout.

Developer
Jun 6, 2012 at 10:27 PM

I actually need this now!.. So.. on that note,let me ask some questions...

1. Is filtering through the query string done in ProjectionPartDriver, and are we only filtering on pagesize and page number?

2. Do you need the token filtering within the PartDriver like part 1?

And maybe I will implement it...