On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Hi, does anyone know how to sort the results of getImageList by a TV value? I am trying to sort the results by the 'date' TV, but to no avail. By default it displays them in the order they were entered (latest last), but i want to be able to control this, or at a minimum reverse the order? I currently have:

      							[[!getImageList? 
        							&tvname=`recommendations`
    								&sortBy=`date`
    								&sortDir=`desc`
    		  						&tpl=`@CODE:<li><h3>[[+name]]</h3>
    								<p class="datefacebook">[[+date]], <a href="[[+facebook]]" target="_blank">[[+facebooktext]]</a></p>
    								<p>[[+recommendation]]</p></li>
      							`]]
    


    Thanks for your help!
    • According to the docs &sort should work

      http://rtfm.modx.com/extras/revo/migx/migx.frontend-usage

      • Hi Paul, i tried that but couldn't get it to work either. Not sure i got the syntax quite right though:

        [[!getImageList? 
            							&tvname=`recommendations`
        								&sort=`{"sortby":"[[+date]]","sortdir":"DESC"}`
        		  						&tpl=`@CODE:<li><h3>[[+name]]</h3>
        								<p class="datefacebook">[[+date]], <a href="[[+facebook]]" target="_blank">[[+facebooktext]]</a></p>
        								<p>[[+recommendation]]</p></li>
          							`]]
        
        • Hi Emily,

          To be honest I've never used it so am only guessing but have you tried:


          [[!getImageList?
                &tvname=`recommendations`
                &sort=`[{"sortby":"date","sortdir":"ASC"}]`
                &tpl=`@CODE:<li><h3>[[+name]]</h3>
                <p class="datefacebook">[[+date]], <a href="[[+facebook]]" target="_blank">[[+facebooktext]]</a></p>
                <p>[[+recommendation]]</p></li>
                `]]
          • Yep smiley

            Tried all variations and none of the below seem to work at all....

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

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

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

            &sort=`{"sortby":"date","sortdir":"ASC"}`
            • this should do it:

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


              whats your output with:
              [[*recommendations]]

              ?

                -------------------------------

                you can buy me a beer, if you like MIGX

                http://webcmsolutions.de/migx.html

                Thanks!
              • Hi, thanks for you response. Unfortunately though it doesn't work. Does that sort by the system date though or the date entered in the TV (date)? I want it to sort by the TV date....

                Using [[*recommendations]] does not display the TV content, whilst [[+recommendations]] does display the TV content - was that what you asking!?
                • [[*recommendations]] 


                  should display the TV-content. Or are you using it inside a getResources-tpl?

                  It does sort by the MIGX-field 'date' then.
                  But let me see your TV-content, please.
                    -------------------------------

                    you can buy me a beer, if you like MIGX

                    http://webcmsolutions.de/migx.html

                    Thanks!
                  • Hi Bruno, i think i've the same problem as Emily. I am trying to sort the results by the 'migxdate' TV but nothing works.

                    This is what i have:

                     
                    [[!getImageList?
                    		&tvname=`woordenschatje`
                    		&tpl=`woordenschatje_overzicht_tpl`
                    		&sort=`[{"sortby":"migxdate","sortdir":"ASC"}]`
                    ]]
                    


                    And the TV content

                    [{"MIGX_id":"1","migxdate":"1383817156","woord":"test1","betekenis":"test1","voorbeeld":"test1"},{"MIGX_id":"2","migxdate":"1383817162","woord":"test2","betekenis":"test2","voorbeeld":"test2"}]
                    


                    Thanks in advance!
                    • Tested this just now:

                      [[getImageList? 
                       &sort=`[{"sortby":"migxdate","sortdir":"ASC"}]`
                       &value = `
                      [
                      {"MIGX_id":"1","migxdate":"1383817156","woord":"test1","betekenis":"test1","voorbeeld":"test1"},{"MIGX_id":"2","migxdate":"1383817162","woord":"test2","betekenis":"test2","voorbeeld":"test2"},{"MIGX_id":"3","migxdate":"1383817144","woord":"test2","betekenis":"test2","voorbeeld":"test2"}]`
                       &tpl=`@CODE:[[+migxdate]],`
                      ]]
                      


                      seems to work. This is the result:

                      1383817144,1383817156,1383817162,
                        -------------------------------

                        you can buy me a beer, if you like MIGX

                        http://webcmsolutions.de/migx.html

                        Thanks!