**Hey there,
I try to get a paginated list of dataobjects, its rendering great with the code below, but the pagination links are not working. What am I missing? I think I need to add the HTTPRequest, but i don’t know how
**
Details of your query go here
use Page;
use SilverStripe\ORM\PaginatedList;
class MyPage extends Page
{
public function MyList()
{
$list = MyDataObject::get();
return new PaginatedList($list);
}
}
Thank you all, stupid mistake, here is the working code in the page CONTROLLER
use PageController;
use SilverStripe\ORM\PaginatedList;
class MyPageController extends PageController
{
public function MyList()
{
$list = MyDataObject::get();
return new PaginatedList($list, $this->getRequest());
}
}
[Emergency] Uncaught BadMethodCallException: Object->__call(): the method ‘getRequest’ does not exist on 'xxx\MyPage’
… if i use the code below. what am I missing?
use Page;
use SilverStripe\ORM\PaginatedList;
class MyPage extends Page
{
public function MyList()
{
$list = MyDataObject::get();
return new PaginatedList($list, $this->getRequest());
}
}