ptailor ptailor - 4 months ago 36
PHP Question

cakephp pagination with advance Filter

I am using cake php scroll pagination to paging products.
I am using group of check boxes in view part to set manual condition by user to paginate.
I used following code to set a condition after ajax request.

class SearchController extends AppController {
public $helpers = array('Html', 'Form', 'Session','Paginator','Js' => 'Jquery');
public $components = array('RequestHandler','Session','Cookie','Paginator');
public function index() {
$this->loadModel("Bangsworkinghrs");
$agetworkinghrs = $this->Bangsworkinghrs->getworkinghrs();
$this->set('agetworkinghrs', $agetworkinghrs);
$this->loadModel("Gig");
$options = array('Gig.subcategory' => 'Logo Design');
if(!empty($this->request->data['filter']['workinghrs'])) {
$options = array('Gig.subcategory' => 'Logo');
}
$this->Paginator->settings = $options;
$agetGigsItem = $this->Paginator->paginate('Gig', $options);
$this->set('agetGigsItem', $agetGigsItem);

}
}


via this code i am able to change condition of paging but server explodes only default 20 records next records is not exploding by server and there is no error message my cakephp version is 2.6.8

Answer

$('#filter').submit(); try submit form and remove ajax refresh data from your jquery part replace filter with your form name.