|
From: Darrel Hoffman on 15 Apr 2008 09:40 Okay, I know that you can use the sort() function to automatically sort a property list - damn handy at that. The trick is, this function sorts the list in order of the properties. So i fI want a list of records sorted by Name, then Date, then Amount, I simply have to make sure that the properties for each record are declared in that order. Here's the kicker: Say I want the user to be able to change the sort-order on the fly. Give them buttons to change it to sorting by Date first or Amount first. Or make it possible to have the list sort in reverse order. Are there any easy ways of doing that? (Short of going through each record and rebuilding them from scratch in a different order each time - that would probably work, but it'd be slow as dirt on a large data set.) This sort of feature is built into the OS (both Win and Mac), and even a feature used in Director's own Cast window in List mode, so one would think it'd be available to scripters, but I can't seem to find a way to do it.
From: Sean Wilson on 15 Apr 2008 17:14 You have to rebuild your propList every time sort criteria are altered
From: Darrel Hoffman on 15 Apr 2008 18:12 > You have to rebuild your propList every time sort criteria are altered Ouch, I was afraid of that. Well, maybe they don't need that feature. The amount of time it would take to rebuild the propList every time they changed their sort criteria just makes it completely non-feasable unless I wanted to have a "Sorting... please wait" thing come up when they did it, which just sucks, because it's the sort of thing you don't expect to take very long. Only other option I can think of is to have several separate copies of the propList at once with the params in different order, and switch between them based on the user's choice, but now we're talking about lots of redundancy and memory wastage (there's alot more than just 3 params in the actual data.) I think I'll just drop this idea for now then. Unless there's some super-snazzy (and not super-expensive) Xtra out there that does this sort of thing more easily...
From: Sean Wilson on 15 Apr 2008 19:11 You could always throw your data in a DB and select it using an "order by" clause. SQLite and Valentin's xtra are a free option: http://dasdeck.de/staff/valentin/xtras/sqlite/
From: stephen_ on 15 Apr 2008 20:18
What do you do with it once it's sorted? Can you just display the data in the sorted order but leave it as is in the list? |