I'm trying to craete an infitie scroll using pagiantion. The JavaScript code work fine i render the whole page on pagination, but it's slow. So i tried converting the template into an ajax page. The paginated pages (after the first) only seem return a to a string that says "DataList".
Here is my controller
class ArtistsPage_Controller extends Page_Controller {
private static $allowed_actions = array (
"Artists", "RepresentedArtists", "OtherArtists", "PaginationCache", "RepCache"
);
public function init() {
parent::init();
}
public function index() {
if (Director::is_ajax()) {
return $this->renderWith(array("AjaxArtists"));
} else {
return Array();
}
}
public function OtherArtists() {
$artists = $this->Children()->filter(array("IsRepresented" => 0));
foreach ($artists as $artist) {
if($artist->Children()->count() == 0) {
$artists->remove($artist);
}
}
return new PaginatedList($artists, $this->request);
}
}