I'm looking for a example on how to use the Batch TAL macro for pagination of folder contents. Up to know didn't find any that explains what to do. Does anyone know of such an example?
Thanks in advance.
Regards, Helio
Something like that ?
<div tal:define="liste python:here.portal_catalog.searchResults({'portal_type' : 'News Item', 'review_state':'published'});
Batch python:modules['Products.CMFPlone'].Batch;
b_size python:20;
b_start python:0;
b_start request/b_start | b_start;
batch python:Batch(liste, b_size, int(b_start), orphan=1);"
tal:condition="liste">
<ul>
<tal:boucle tal:repeat="item batch">
<li tal:define="oddrow repeat/item/odd;"
tal:attributes="class python:test(oddrow, 'even', 'odd')">
<!-- stuff -->
</li>
</tal:boucle>
</ul>
<div metal:use-macro="here/batch_macros/macros/navigation" />
</div>
Found this resource:
http://raw.zniper.net/bits/batching-in-custom-template
it worked very well.
Regards, Helio
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With