jury89
jury89

Reputation: 302

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->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?

Upvotes: 0

Views: 430

Answers (1)

Grad van Horck
Grad van Horck

Reputation: 4506

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?

Upvotes: 1

Related Questions