Quote from: mpjtone at Mar 06, 2010, 03:37 PM
I’m trying to find out if there has been any change to this. Is it possible to use a template variable in the &sortBy parameter within the Wayfinder call? Would be very useful, since lists of database items could be re-sorted by many more things that are actual item attributes, not just the limited list of document values.
You can write a custom snippet/query to do this and return what you need, though sorting on a TV value is going to be much slower that sorting on predefined Resource attributes because of the nature of Template Variables. This is even worse if you have some kind of dynamic information stored as your Template Variable values (e.g. @INHERIT, etc.) because then you have to process each and every TV value after retrieving it from the database before you can sort.
Let me just say that using MODx Resources to represent "database items" is really a shortcut, and not at all the best way to approach developing custom sites in MODx, especially with any significant quantities involved. IMO, data that needs to be custom sorted by user-defined attributes spells custom data model. This is the difference between developing a presentation layer of unique "views" (what MODx is for) and a "model" layer (for accessing/managing custom data that is not well represented by having each row be a MODx Resource, i.e. web page). This makes your custom data reusable in an infinite variety of presentation views, your dynamic presentation layer much lighter, and your ability to sort your data on demand efficiently much improved.