We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28120
    • 380 Posts
    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
      • 3749
      • 24,544 Posts
      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
        • 28120
        • 380 Posts
        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
          • 3749
          • 24,544 Posts
          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
            • 28120
            • 380 Posts
            Thanks Bob
              • 34183
              • 23 Posts
              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)
                • 52927
                • 3 Posts
                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?
                  • 3749
                  • 24,544 Posts
                  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
                    • 51192
                    • 11 Posts
                    This one should really be a feature request. The default sorting is impractical and should be configurable in the TV settings