Jump to content

Troubles with pagination. As always.


froot
 Share

Recommended Posts

I'm trying to build a search module.
See my rep here https://github.com/dtjngl/simpleSearch.git

Once installed, you should be able to test it, just make sure you adjust $this->indexedCategories in the module's init() function. (I will change this later to be defined in the module's config file instead.) 

Then use the public functions to render the different parts of the search page:

echo '<div id="filters">';
echo $simpleSearch->renderFilters();
echo '</div>';

echo '<div id="criteria">';
echo $simpleSearch->renderCriteriaMarkup();
echo '</div>';

echo '<div id="paginationstring">';
echo $simpleSearch->renderPaginationString();
echo '</div>';

echo '<div id="overview">';
echo $simpleSearch->renderOverviewMarkup();
echo '</div>';

echo '<div id="search-results">';
echo $simpleSearch->renderResultsMarkup();
echo '</div>';

echo '<div id="pagination">';
echo $simpleSearch->renderPaginationMarkup();
echo '</div>';


The problem with the pagination:

$this->renderResultsMarkup()
the entries seem to paginate alright

$this->renderPaginationString()
the entries seem to paginate alright

$this->renderPaginationMarkup()
pagination links DON'T show up at all!

I don't know what I'm still not getting about pagination and what I'm doing wrong. When do I fetch and where do I store all the results? And at which point do I paginate the results? It just never makes sense to me. Any help and advice is much appreciated.

Link to comment
Share on other sites

OK I figured it out. It appears that when I render the results, I need to amend the selector's start and limit, but when I render the pager, I cannot do that, I need to use the methods
 

->setStart()

and
 

->setLimit()

I need to remember to not mix this up in the future. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...