tags:

views:

27

answers:

2

Hi i am facing a issue with the pagination helper. I am sorting the records based on user criteria like date range etc via drop downs alt text. And it works fine. It paginates properly. But when i click on page 2, it shows page 2 of all results an not the sorted results. How can i fix it. The fields are sorted via POST and not GET and don't want it to be GET

A: 

It's hard to reverse engineering your source from a screenshot but i think the main problem is you're using POST therefore when user clicks to '2' you need to use some javascript to mimick a POST request.

fabrik
i dont think nay code is needed still if u need it i will post it
Web Developer
And what about my idea?
fabrik
+1  A: 

You can try to store the post in the session, and then to fetch it when the page is loaded.

i.e.

if(isset($this->data)){
   if(isset($this->data['clear'])){ //some field (button) which will clear the session
       $this->Session->delete('post');
       unset($this->data);
   }
   $this->Session->write('post', $this->data);
}

if($this->Session->read('post')){
   $this->data = $this->Session->read('post');
}

If you want take a look on this component: Filter component. The post is a little bit old, but the component is adequate still and I am using it in my projects :)

Nik