We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 37339
    • 10 Posts
    I'm making a site for someone, and trying to keep the backend as idiot-proof as possible. MIGX has helped immensely so far! I do have one question, though.

    There are a few instances where I use MIGX for lists that will be constantly updated. All new entries automatically go to the bottom of the grid in the TV. Is there an easier to way to list everything in reverse order (bottom entries first), rather than continuously dragging the new entries to the top of the grid?

    Maybe some sort of getResources-styled call like :
    [[getImageList? &tvname=`foo` &tpl=`bar` &sortdir=`ASC`]]


    It's obviously not terribly pressing, as dragging works fine, and I don't care if the client has to spend an extra 1.4 seconds moving their mouse. I was mainly just curious. Thanks, all! (Extra thanks to Bruno for MIGX!)

    This question has been answered by pepebe. See the first response.

    • discuss.answer
      • 23018
      • 353 Posts
      I have a slightly modified version of getImageList on github . I don't know If it will work with the latest version of MIGx (it works with 2.2.1), but you may have a try.

      https://github.com/pepebe/MIGX/blob/master/core/components/migx/elements/snippets/snippet.getImagelist.php

      Right now it only supports sorting by a single parameter defined in &sortBy.The &sortOrder paramter expects asc or desc.

      If it doesn't work, let me know and I'll try to fix it. If you need something more fancy, You'll have to wait until Bruno comes up with something awesome in a future version.

      Regards,

      pepebe
        Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
        • 37339
        • 10 Posts
        Works perfectly, mate. This is exactly what I was hoping for. Thank you very much for your help!
          • 23034
          • 10 Posts
          It's been a while since pepebe posted his solution. I've tried the code which I've found at github, but it didn't worked for me (v.1.4.1)

          @version 1.4.1
          * Changes in 1.4.1
          * added &sortDir amnd &sortBy paramteres as well as sort features.

          I've used the call from Hypatia, didn't worked for me with the latest MIGX version (2.6.6), neither with the original getImagelist snippet or the one of pepebe. (https://github.com/pepebe/MIGX/blob/ca8d33e07a8e97d2fb6333ea5a88dd7ebd6fa374/core/components/migx/elements/snippets/snippet.getImagelist.php)

          What works like a charm is sorting when I specify a field like the "title":
          &sortBy=`title`
          &sortDir=`asc`


          What I want to achieve is to get the reversed sort order of the drag&drop list. That my client don't has to move a newly added item to the opposite end of the list to let it appear on top of other elements on the website.

          Best,
          Daniel
            • 4172
            • 5,888 Posts
            what about &reverse=`1`
              -------------------------------

              you can buy me a beer, if you like MIGX

              http://webcmsolutions.de/migx.html

              Thanks!
              • 23034
              • 10 Posts
              Yes, that worked!

              But I had to restore the original "getImageList" snippet which was shipped with MIGX (version 2.6.6) instead of using the one provided by pepebe.

              Thanks for the hint Bruno17. (And enjoy your beer ;-P)

              I wonder if there's a list of all options available for getImagelist? Seems like the "reverse" option isn't documented anywhere.

              This is my complete Call (I've used the getPage package to get a pagination, as the client has 40-50 items to show)
              [[!getPage?
              &element=`getImageList`
              &tvname=`portfolio`
              &tpl=`migx.portfolio.tpl`
              &limit=`16`
              &reverse=`1`
              &pageFirstTpl=`<li class="control"><a[[+classes]][[+title]] href="[[+href]]">First Page</a></li>`
              &pageLastTpl=`<li class="control"><a[[+classes]][[+title]] href="[[+href]]">Last Page</a></li>`
              ]]



              Just one additional question, is there a why to deal with the Number of a list entry. Sorting them with drag&drop, there must be a ID or something similar then? Using the following option within the getImagelist call sounds quite promising to me, but didn't worked:
              &sort=`[{"sortby":"MIGX_id","sortdir":"DESC","sortmode":"numeric"}]`]]