Preserving form data when using paginator::sort?

Go To StackoverFlow.com

0

I'm php/cakephp newcomer and my question is - is there a way to preserve form data (that is not saved in model) after you sort your data using paginator::sort? Obviously, when you click on paginator sort link you go to different URL, so _posted data vanishes. To give you a picture what I have in my code - there is single form, with range slider in it and checkboxes set.

2012-04-04 19:15
by kK-Storm
in pagination page what data will be there? any search keyword!! what about using session or using ajax which wil not submit page just slide the paging di - zod 2012-04-04 19:46
In pagination page supposed to be same data which I filtered using my range slider and/or checkboxes, with sorting order applied by paginator generated URL. I didn't quite get what you mean by "any search keyword!!". I know abstract things about Ajax, but I never really got to use it so far : - kK-Storm 2012-04-05 10:48


1

This works for me when I needed to share posted data between different actions in a controller. In the controller class I add this bit of code to the beginning of each action:

// retrieve or save search data
if(!empty($this->data)) 
    $this->Session->write('SearchData', $this->data);
else
    $this->data = $this->Session->read('SearchData');
2012-04-04 21:07
by Annabel
Thanks, that might work. I'll try to use your solution later today and then comment if it worked for me - kK-Storm 2012-04-05 10:51
After adding some logic and few tweaks your solution fit almost perfectly. Thanks again - kK-Storm 2012-04-05 16:54
Ads