J1.5 talk

Difference between revisions of "Using JPagination in your component"

From Joomla! Documentation

(New page: This code does not work correctly as it stores the limitstart into a session variable. So, when clicking upon the first item in your pages list, no limitstart variable is present and so ...)
 
Line 9: Line 9:
  
 
$limitstart = JRequest::getVar('limitstart',0);
 
$limitstart = JRequest::getVar('limitstart',0);
 +
 +
Confirmed and fixed.  Thanks.  [[User:Chris Davenport|Chris Davenport]] 23:03, 31 May 2009 (UTC)

Revision as of 18:03, 31 May 2009

This code does not work correctly as it stores the limitstart into a session variable. So, when clicking upon the first item in your pages list, no limitstart variable is present and so the previously saved limitstart value is reused.

ie. you can go to pages 2, 3, etc. but not back down to 1.

A work around I have used is to always get the value from the Request object.

//$limitstart = $mainframe->getUserStateFromRequest($option.'.limitstart', 'limitstart', 0, 'int');

$limitstart = JRequest::getVar('limitstart',0);

Confirmed and fixed. Thanks. Chris Davenport 23:03, 31 May 2009 (UTC)