Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Template Questions /

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

$Pos with respect to Pagination

Go to End



Community Member, 52 Posts

7 December 2010 at 12:34pm

Edited: 07/12/2010 12:40pm

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: which includes the patch.

Many thanks,

~ Brice