Jump to:

3443 Posts in 1030 Topics by 871 members

Template Questions

SilverStripe Forums » Template Questions » $Pos with respect to Pagination

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1
Go to End
Author Topic: 708 Views
  • brice
    Community Member
    51 Posts

    $Pos with respect to Pagination Link to this post

    I have a situation where I would like to know the 'absolute' position of an item in a set with respect to DataObjectSet pagination. We inherited a site where comment participants referenced other comments by the ID/number -- e.g. first comment is always #1, 2nd comment #2, and so fourth.. and dialog looks like "Ditto what #39 says".

    Anyhow... I thought this would be simple to implement but soon found it nearly impossible to access the current DataObjectSet of a <% control %> loop in order to determine page offset (e.g. PageLength * (CurrentPage -1)).

    I ended up writing a patch to extend the DataObjectSet Iterators to include PageOffset, as well as a $PosInSet method to viewable data which essentially returns $Pos(PageOffset).

    Perhaps there is a graceful out-of-box method to do this that I have overlooked -- or perhaps there's a more desirable approach in extending Sapphire to accomplish this; please let me know...

    I've opened a ticket regarding this: http://open.silverstripe.org/ticket/6252 which includes the patch.

    Many thanks,

    ~ Brice

Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.