Quantcast
Channel:
Viewing all articles
Browse latest Browse all 4235

Re: Pagination on $belongs_many_many

$
0
0

Hi, i am still stucked on this. In page.php i have a many_many relation to the employees (Mitarbeiter). They are related to any page via GridFieldConfig::create(). That works fine. Now i want to show a PaginatedList of these emloyees. Therefore i use the following code in the page.php controller as described in the documentation:

public function PaginatedPages() {
$paginatedList = new PaginatedList($this->Mitarbeiter(), $this->request);
$paginatedList->setPageLength(2);
$paginatedList->setPageStart(1);
$paginatedList->setLimitItems(0);
//$paginatedList->setTotalItems(2);
return $paginatedList;
}

But the function returns all 6 emloyees in the template instead of two? Also the Pagination is showen like

1
<a href="hotel/ueber-uns/team/?start=2#Mitarbeiter">2</a>
<a href="hotel/ueber-uns/team/?start=4#Mitarbeiter">3</a>
<a class="next" href="hotel/ueber-uns/team/?start=3#Mitarbeiter">Die nächste Seite anschauen</a>

I think there went something wrong, too. Even i used the template code from the documentation http://doc.silverstripe.org/framework/en/3.1/howto/pagination

I have read the Documentation, many forum entries and many IRC Logs. I cant get this one working. Can anybody help, please? Has anybody a working example of a PaginatedList from a many_many relation?


Posted to: Pagination on $belongs_many_many | Show Thread | Post Reply


Viewing all articles
Browse latest Browse all 4235

Trending Articles