?sort_by() takes a string or array of strings as arg to indicate which field/fields to sort by, so I've tried type-casting to an integer where i'm passing it to the sort property but it fails to render the list, ex:
Copy code
<#list JSON.items?sort_by(palletnum?number) as item>
s
stalbert
11/28/2018, 5:54 PM
Can you sort the items yourself (coercing to numbers in the meantime)? If you're building the JSON.items data yourself, can you sort it (in code) before passing to the template renderer?
t
Trevor McLean
11/28/2018, 6:02 PM
Hmm, this may work actually. I dismissed the idea right away since I'm building the JSON object from a sublist, and sorting sublists is usually a cheap ticket to insanity, but there's no reason i can't sort the JSON object after sourcing
Trevor McLean
11/28/2018, 6:02 PM
Thanks!
s
stalbert
11/28/2018, 6:08 PM
right, sounds like an easy job for lodash.sortBy() if you can do it in JS land rather than Freemarker land.