We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 2984
    • 3 Posts
    The Wayfinder parameters list muddydogpaws states this:

    description: The sortBy parameter allows the output to be sorted by any of the above fields on a level by level basis. This means that each submenu will be sorted independently of all other submenus at the same level. Random will sort the output differently every time the page is loaded if the snippet is called uncached.
    So ... how do you specify that you want a different sort order for different levels? I.e. I want my top level to be sorted by the default menuindex (’cause I always want my Home page on the far left, etc), and then all the rest sorted by pagetitle for an alphabetic sort. My current chunk:

    <div id="menu">[[Wayfinder? &startId=`0` &level=`5` ]]</div>

    I’m not currently using tpls, and would like to continue to not do so if possible, but if that’s what’s needed so be it. Just any examples would be great!
      • 4172
      • 5,888 Posts
      you can try a nested wayfinder-call in your rowTpl:
      <div id="menu">[!Wayfinder? &startId=`0` &level=`1` &rowTpl=`MyRowTpl`&sortBy=`menuindex`!]</div>


      the chunk ’MyRowTpl’ for example:
      <li[+wf.id+][+wf.classes+]>
      <a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>
      [+wf.wrapper+]
      [[Wayfinder? &startId=`[+wf.docid+]` &level=`4` &sortBy=`pagetitle`]]
      </li> 


      Bruno
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 15987
        • 786 Posts
        That parameter description is probably a little confusing. It sorts each level by what you set in that parameter. There is no way to specify a different sort order for each level of the menu.

        Bruno17s idea sounds good though, that should work. You could remove the [+wf.wrapper+] from the template though since no child documents will be output by the top level wayfinder call.
          • 4264
          • 20 Posts
          Hi,

          I have a question related to sorting.
          The sorting solution by Bruno does work fine, but it raises another issue in my situation.
          Some items in the topnavigation contain subitems, which I want to sort descending, instead of the default, ascending.
          I use the &hideSubMenus=`TRUE` parameter to only show active submenus.
          The sorting works fine with Bruno’s solution, but now all submenus are shown, instead of just the active one.

          My document template contains the following Wayfinder call:
           [[Wayfinder? &startId=`0` &level=`0` &rowTpl=`nav`  &hideSubMenus=`TRUE`]]  
          


          And here’s my rowtemplate:
          <li[+wf.id+][+wf.classes+]><a href="[+wf.link+]" title="[+wf.title+]" [+wf.attributes+]>[+wf.linktext+]</a>
          [[Wayfinder? &startId=`[+wf.docid+]` &rowTpl=`nav` &sortOrder=`DESC` &hideSubMenus=`TRUE`]]  
          </li>
          


          Suggestions, anyone?
          Thanks!