We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 19604 ☆ A M B ☆
    • 179 Posts
    Quote from: OpenGeek at Jul 15, 2011, 09:49 AM

    Quote from: hwmaier at May 09, 2011, 06:29 PM

    Also chaining the getResources calls is not an option for my application either as again the tvFilters parameter cannot be passed on to the second level getResources call.
    Why can you not pass tvFilters to the second level call? It should be as easy as sharing a PropertySet across all your getResources calls with the same tvFilters value set.
    I just found a way to sort a tree of resources with getResources:

    &sortby=`{"parent":"ASC","menuindex":"ASC"}`

    Works for 2 levels if the ids of the parent folders are growing.
    More is here: http://modxcms.com/forums/index.php/topic,66664.msg375810.html#msg375810

    Oliver
      MINDEFFECTS – DESIGN for PRINT, WEB and MEDIA
      http://twitter.com/mindeffects · http://www.facebook.com/mindeffects · http://www.youtube.com/mindeffects/ · skype://mindeffects_oliver
      • 12512
      • 42 Posts
      Quote from: OpenGeek at Jul 15, 2011, 09:49 AM

      Quote from: hwmaier at May 09, 2011, 06:29 PM

      Also chaining the getResources calls is not an option for my application either as again the tvFilters parameter cannot be passed on to the second level getResources call.
      Why can you not pass tvFilters to the second level call? It should be as easy as sharing a PropertySet across all your getResources calls with the same tvFilters value set.

      I probably have to explain what I meant with chaining: Doing a getResource call on the the first level and have another getResource call for the child levels in a template you pass to the the first-level call. I have not found a method to pass on the tvFilter parameters (which can vary) to the getResource calls embedded in the templates. Wouldn’t be a problem if the tvFilters would be the same for every call then you can use propertysets or hardcode them but they are not in my application (eg keywords).
        • 12512
        • 42 Posts
        Quote from: mindeffects at Jul 15, 2011, 09:59 AM

        I just found a way to sort a tree of resources with getResources:

        &sortby=`{"parent":"ASC","menuindex":"ASC"}`

        Works for 2 levels if the ids of the parent folders are growing.

        I would not say this solves this feature request in a generic way. Tree wise sorting using your method works only in the special case that the parent resource IDs are in growing order. Once you add resources to the tree at later stage, your method breaks.

        Also it works only for the special case of 2 levels. What about more levels?
          • 19604 ☆ A M B ☆
          • 179 Posts
          Quote from: hwmaier at Jul 15, 2011, 07:30 PM

          I would not say this solves this feature request in a generic way. Tree wise sorting using your method works only in the special case that the parent resource IDs are in growing order. Once you add resources to the tree at later stage, your method breaks.
          Also it works only for the special case of 2 levels. What about more levels?
          Well, this was not ment as a final solution for all tree sorts. It is a workaround which only works under certain circumstances. I wrote that and you repeated them. But if you need only 2 levels, you can make it work with my method. I thinks that’s better than not getting anythings in the tree to work.
          But believe me, I would very much appreciate it if getResources would be able to walk the the whole tree with unlimited levels etc.

          best
          Oliver
            MINDEFFECTS – DESIGN for PRINT, WEB and MEDIA
            http://twitter.com/mindeffects · http://www.facebook.com/mindeffects · http://www.youtube.com/mindeffects/ · skype://mindeffects_oliver