We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 74
    • 74 Posts
    All documents has a TV checkbox named "anons", for example.
    I need to show all documents ordered by date, but first must be all documents with TV checked.
    I can`t find solution.

    I try to solve it by 2 calls.
    First:
    [[Ditto? &startID=`2` &tpl=`ditto` &tagData=`documentTags` &filter=`anons,1,1` ]]

    for docs with TV checked.
    And second call:
    [[Ditto? &startID=`2` &summarize=`5` &tpl=`ditto` &paginate=`1` &filter=`anons,1,2` &id=`1`]]
    for other docs.
    pagination is linked to second call:
    <div class="ditto_pages">[+1_previous+] [+1_pages+] [+1_next+]</div>
    

    Second call with pagination works great.
    First call shows the same docs on every page. Of course it works correct.
    But i need to show docs with TV checked (first call) only on first page.


      • 4971
      • 964 Posts
      Anons is a TV so you should use [+anons+]
        Website: www.mercologia.com
        MODX Revo Tutorials:  www.modxperience.com

        MODX Professional Partner
        • 16278
        • 928 Posts
        Using Ditto 2.1, you can specify multiple sort order with the &orderBy parameter, so you could have just one Ditto call, sorting by your checkbox field then by your date field, something like:
        [[Ditto? &parents=`2` &display=`5` &tpl=`ditto` &paginate=`1` &orderBy=`anons DESC,createdon DESC` &id=`1`]]
        Note the other up-to-date parameters: &parents can have multiple values, and &display replacing &summarize. The snippet will translate &startId and &summarize into these anyway.

        Unless you are using PHx, or your pages are set not to be cached, you’ll need the Ditto call to be [!uncached!] for pagination to work - but if it’s working now, that evidently isn’t a problem.
        smiley KP
          • 74
          • 74 Posts
          Thanks!
          One Ditto call = Multiple sort order.
          And of course [!uncashed!] call.
          Elegant solution, thanks Kp52 grin