In my component I have several list views that have the possibility of multiple pages.
What's happening is that certain variables, namely $limit and $limitstart are persisting when the admin clicks from page 2 of list 1 to (what is supposed to be) page 1 of list 2. The trouble is that list 1 may have more than one page, but if list 2 has only page of results then nothing shows up. I notice that in my query in the second view LIMIT 20 140 shows up when it should be LIMIT 20 0. The 140 is coming from the last view list when the admin selected a page of results starting with row 140 from a previous view.
I have tried using a getUser to grab the 'view' and use it to try and reset the limit and limitstart in the model but it doesn't seem to have an effect. I have also noticed in the debug that I am getting two queries for my main list - one with no limit and limitstart and one with an incorrect limit and limit start.
Code: Select all
// Get the pagination request variables
$limit = $mainframe->getUserStateFromRequest( 'global.list.limit', 'limit', $mainframe->getCfg('list_limit'), 0);
$limitstart = $mainframe->getUserStateFromRequest( $option.'limitstart', 'limitstart', 0 );
// In case limit has been changed, adjust limitstart accordingly
$limitstart = ($limit != 0 ? (floor($limitstart / $limit) * $limit) : 0);
$testview = JRequest::getVar( 'view' );
if ($testview != 'mimetypelist')
{
$filter_order = '';
$filter_order_Dir = '';
$limit = 0;
$limitstart = 0;
$this->setState('limit', $limit);
$this->setState('limitstart', $limitstart);
}
$this->setState('limit', $limit);
$this->setState('limitstart', $limitstart);
Any ideas? Is there a way to reset the user variables when you go from one view to another?
Joomla 1.5.1