Though your question is not clear, I will try to answer it in the way I think will make sense.
Pagination: This view is like a book were you actually have to flip through each "Page". If you are on Page 2, you won't see what's on Page 1.
LoadMore: You start on Page 1 then you append results of Page 2 to the View where Page 1 is. This way you can view Page 1 and Page 2 on the same Page creating a stack of pages.
For LoadMore which you asked.
You need a js variable var currentPage = 1;
to hold the current page to be loaded from the server. Each time you request data you will need to provide the current page you are on. Logically something like this
- You render your page with Page1 loaded; currentPage = 1;
- OnClickingLoadMore button; currentPage++;
- Send the request via ajax.
var url = 'server.com/posts/pull?page='+currentPage;
- Append returned data on the current view.
PostsController.php
add the method name to the allowed-action
private static $allowed_actions = [
'pull',
];
Create a method called "pull" with the code below in it.
$oListings = BlogPost::get();
$oList = new PaginatedList( $oListings, $this->request );
$oList->setPageLength( $limit );
$oList->setCurrentPage( $page );
Lastly your routes.yml (simplified)
SilverStripe\Control\Director:
rules:
'posts//$Action/$ID/$OtherID': 'PostsController'
Lastly using jQuery you can APPEND [http://api.jquery.com/append/] to add more content to your page.
Hope this helps