MIGX

Using the Sort Property to Sort getImageList Output

light fare

Sorting getImageList Output

The output of the getImageList snippet can be sorted on any of the MIGX form fields. Here's how, from a Slack conversation.

sottwell asked...

MIGX and getImageList. How to sort the output by a given field? I tried "&sort=`area`".

The Solution:

jako says...

It has to be a json string:

  &sort=`[{"sortby":"area","sortdir":"ASC"}]`
  

What's the Story?

The getImageList "sort" property takes a JSON string to specify the MIGX form field to sort by and the sort direction, ASC or DESC.