MIGX: Enable sorting by any columns in MIGX
this worked 8 months before. I have to check if it is still working...
Just a tiny hack to enable sorting a MIGx by ANY one of it's columns.
Add the following lines below /* get default properties */ near the top:
$sortBy = $modx->getOption('sortBy', $scriptProperties, '');
$sortOrder = $modx->getOption('sortOrder', $scriptProperties, 'asc');
Just before $idx = 0; (arround line #122) add this bit of code:
// v1.1
            if( array_search( $sortBy , array_Keys($items) ) !== FALSE ) {          
                foreach($items as $k=>$v) {
                    $b[$k] = $v[$sortBy];
                }
                    switch( $sortDir ) {
                    case'asc':
                        asort( $b );
                        break;
                    case'desc':
                        arsort( $b );
                        break;
                    default:
                        asort( $b );
                        break;
                    }
 
                foreach($b as $key=>$val) {
                    $c[$key] = $items[$key];
                }               
                $items = $c;
            }
Edit: Please note that v1.0 was a cut'n'paste accident. This one works.
Now you can call getImageList with 2 new parameters:
&sortDir=`asc_or_desc`
&sortBy=`add_dataIndex_here`