RequestHandler->isAjax()) { $this->pageTitle = "Customer List"; // clear the session on first page visit $this->Session->del($this->name.'.search'); } if(!empty($this->data)) $search = $this->data['Customer']['search']; elseif($this->Session->check($this->name.'.search')) $search = $this->Session->read($this->name.'.search'); $filters = array(); if(isset($search)) { $filters = array("lower(Customer.name) like '%".low($search)."%'"); $this->Session->write($this->name.'.search', $search); } $this->set('customers', $this->paginate('Customer', $filters)); if($this->RequestHandler->isAjax()) { $this->viewPath = 'elements'.DS.'customers'; $this->render('paging'); } } ... ?>