Symfony: paginate a filtered list
Hi i have the following code:
public function executeFilter(sfWebRequest $request) {
$c = new Criteria();
$c->add(NomenclatoreCodicePeer::LIST_CODE, $request->getParameter('list_code'), Criteria::LIKE);
$pager = new sfPropelPager('NomenclatoreCodice', sfConfig::get('app_max_jobs_on_category'));
$pager->setCriteria($c);
$pager->setPage($this->getRequestParameter('page', 1));
$pager-开发者_JAVA技巧>init();
$this->pager = $pager;
}
It works fine, but when i press "next page" button it loose the filtered items and page as if filter had not been set. how can i fix it?
You should debug the queries to see if they are correct on each page.
My first guess would be that the list_code
parameter is not set on subsequent requests.
Is the list_code
parameter also passed to the url for the second page? And is the filter
action called on the second page? Or just your default list
(?) action?
精彩评论