I'm a bit confused.
When I look at the link created by pagination in the front end, I see a query parameter called start included in the individual page number links and Start and End links.
However, the method populateState
in the base JModelList
class looks for limitstart
if $this->context
has a non null value
.
Since the base constructor for JModelList
sets $this->context
to be equal to <component_name>.<model_name>
it looks like in the default case $this->context
will not be null, so populateState will usually assign the value from $_GET['limitstart']
using getUserStateFromRequest()
as the snipped code shows:
$value = $app->getUserStateFromRequest($this->context . '.limitstart', 'limitstart', 0);
$limitstart = ($limit != 0 ? (floor($value / $limit) * $limit) : 0);
$this->setState('list.start', $limitstart);
I would be really grateful if someone could explain why things are done this way, and what I have to do to get populateState and pagination to agree on the variable that holds the row that the page should start on.
TIA.
$pagination = $this->get('Pagination');
in view file then required state vars in model's populateState method are easy to understand in this way -$limit= $app->getUserStateFromRequest('global.list.limit', 'limit', $app->getCfg('list_limit'), 'uint'); $this->setState('list.limit', $limit); $limitstart = JRequest::getUInt('limitstart', 0); $this->setState('list.start', $limitstart);