nextbatches

toc
<mm:nextbatches>

This `listprovider' tag provides a way to implement `paging' or `batching' for large search results. It requests the `offset' and `maxnumber' settings of the surrounding querycontainer and calculates the next possible `offsets'. This is done by counting the query result without `maxnumber'. You get an exception if the `maxnumber' or `offset' tags are not used.

As a list, this tag produces Strings, which you could for example use in its body with <write />. These string represents `offsets' which you can use in an url. You can of course also in the normal way give the list an id, and use the `referids' attribute of the url tag.

If you prefer to have a `page' rather then an offset, then the `index' tag can be used. The default `offset' for the index tag is set to let it be `batch numbers'.

(since: MMBase-1.7)
see alsopreviousbatches | offset | maxnumber | referids attribute of url | write | index
attributes
  • max
    The maximum number of batches to be produces. For really huge result, even the number of batches can be too large, so you want to limit it. You should also use it (max="1") if you only want to implement a `next page' button.
  • maxtotal
    In stead of `max' you could also use maxtotal. The tag will calculate how many batches `previousbatches' did need, and if that is zero, there can be `maxtotal' next batches. If it is more then zero, nextbatches will get less. If there are both many next batches and previous batches, then they get both the half of `maxtotal' batches.
  • indexoffset
    The produced indexes can be used as page numbers. Default this page-numbering starts at 0, with this you can change it, e.g. set it to 1.
nodereferrer attributes
writer attributes
listprovider attributes
contextreader attributes
contextwriter attributes
contextreferrer attributes
querycontainerreferrer attributes
containerreferrer attributes
example 1
<mm:relatednodescontainer type="responses">
  <mm:maxnumber value="12" />
  <mm:offset value="" />
  <mm:previousbatches indexoffset="1">
    <mm:link referids="r.s@s,_@offset,n">
      <a href=""><mm:index /></a>
    </mm:link>
    <jsp:text>, </jsp:text>
  </mm:previousbatches>
  <span class="current"><mm:index offset="1"/></span>
  <mm:nextbatches indexoffset="1">
    <jsp:text>, </jsp:text>
    <mm:link referids="r.s@s,_@offset,n">
      <a href=""><mm:index /></a>
    </mm:link>
  </mm:nextbatches>
</mm:relatednodescontainer>