On March 26, 2019 we launched new MODX Forums. Please join us at the new MODX Community Forums.
Subscribe: RSS
  • Anyone know how to change the sort sequence when the resources get listed for a TV where the input type = Resource List?

    Current it's listing all resources, which is good, but the listing appears to be sorted by

    Parents
    then Children
    then throw in a bit on randomness smiley

    I'd probably prefer it all by pageTitle
    • I don't think there's a way to do it, but it would be a good feature request.

      Could the current order be Resource ID? If so, you could control it by creating them in the right order.
        Did I help you? Buy me a beer
        Get my Book: MODX:The Official Guide
        MODX info for everyone: http://bobsguides.com/modx.html
        My MODX Extras
        Bob's Guides is now hosted at A2 MODX Hosting
      • Hi Bob, it's not sorted on Resource ID. Anyhow trying to create resources with the resource ID you want in order to get alpha sort would only really be sustainable for about the first day.

        Your book's arrived. Not only is it helping improve my MODX knowledge but it's also improved my muscle tone, particularly in my biceps smiley
        • Thanks for buying the book. smiley


          You're right. Here's the sort criterion:

          $c->sortby('Parent.menuindex,modResource.menuindex','ASC');


          So you could, in theory, control it by setting the menuindex on all the resources. In fact, it might work to just sort the tree by pagetitle.

          You could also change that code in
          core/model/modx/processors/element/tvs/renders/mgr/input/resourcelist.php (line 50) to this:

          $c->sortby('modResource.pagetitle','ASC');


          I don't think it would have any adverse side effects, but I'm not positive.
            Did I help you? Buy me a beer
            Get my Book: MODX:The Official Guide
            MODX info for everyone: http://bobsguides.com/modx.html
            My MODX Extras
            Bob's Guides is now hosted at A2 MODX Hosting
          • Thanks Bob
            • This is a good find, thanks guys!

              A small path/name update for MODX 2.2.6:
              core/model/modx/processors/element/tv/renders/mgr/input/resourcelist.class.php (line 52)
              • Quote from: BobRay at Nov 28, 2011, 03:15 PM
                Thanks for buying the book. smiley


                You're right. Here's the sort criterion:

                $c->sortby('Parent.menuindex,modResource.menuindex','ASC');


                So you could, in theory, control it by setting the menuindex on all the resources. In fact, it might work to just sort the tree by pagetitle.

                You could also change that code in
                core/model/modx/processors/element/tvs/renders/mgr/input/resourcelist.php (line 50) to this:

                $c->sortby('modResource.pagetitle','ASC');


                I don't think it would have any adverse side effects, but I'm not positive.

                Luckily this fix still works in ModX 2.6.5!
                But I'm not sure if this manual change will persist after updating ModX? Will it?
                • Probably not, but if you create a backup copy of the changed file it will still be there.
                    Did I help you? Buy me a beer
                    Get my Book: MODX:The Official Guide
                    MODX info for everyone: http://bobsguides.com/modx.html
                    My MODX Extras
                    Bob's Guides is now hosted at A2 MODX Hosting
                  • This one should really be a feature request. The default sorting is impractical and should be configurable in the TV settings