21309 Posts in 5738 Topics by 2603 members
General Questions
SilverStripe Forums » General Questions » Extending DataObjectSet by FirstPageLink, LastPageLink
General questions about getting started with SilverStripe that don't fit in any of the categories above.
Moderators: martimiz, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 798 Views |
-
Extending DataObjectSet by FirstPageLink, LastPageLink

20 November 2009 at 11:42pm
Hello,
is it possible to extend DataObjectSet by two functions that returns the link for the first respectively the last page? I tried to decorate it by an extension object. Unfortunately the extension object cannot access the $pageSize or $paginationGetVar fields (because they are protected????).
It should be very simpe though. Just add:
/**
* Returns the URL of the first page.
* @return string
*/
public function FirstLink() {
if($this->pageStart > 1) {
return HTTP::setGetVar($this->paginationGetVar, 0);
}
}/**
* Returns the URL of the last page.
* @return string
*/
public function LastLink() {
if($this->pageStart + $this->pageLength < $this->totalSize) {
return HTTP::setGetVar($this->paginationGetVar, ($this->TotalPages() - 1) * $this->pageLength);
}
}
| 798 Views | ||
|
Page:
1
|
Go to Top |

