Thursday, February 27, 2014

Re: Pagination Sort, Resetting Data


你是用 Paginator->sort() 產生的連結(我知道這裡你把它變成checkbox了),再點擊它的時候,已經不是 post request;
但取而代之是傳入 querystring 或是 named parameters,這時候你的 searchByBrowser 應該要在接收到這些與sort有關的參數時,
最後要再指定給 $this->request->data,這樣 view 在被 rendering 的時候就會把 request data 的值填回你的 Form 表單。



Eric Chan <eric.hf.chan@gmail.com> 於 2014/2/27 下午12:14 寫道:

Hello,

I just starting baking with CakePHP and I'm slowly grasping the basics.

So far I've created a view to display all the data in table format from a table in the database with pagination.
There is a column in the table that contains browser information (Firefox, Chrome, Safari...etc).
So on the view I made some checkboxes using Form->checkbox, with each check box representing a browser. 
When the the submit button is pressed, the POST request is sent to the searchByBrowser function in the controller and 
the view is updated with the appropiate data.

Now I am adding sort() functionality using Paginator->sort() and it sorts by the specified column just fine.  

However, when I use the searchByBrower function to get the appropiate view and then try and sort the displayed data, it resets everything
to showing all the full dataset and the checkbox is no longer checked.

Is there a way to get everything to work the way it should with just CakePHP?

Thanks.


1 - Full data set view


2 - Just Firefox data

3 - Sorted on http_method, full dataset again (instead of just firefox data)







--
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP
 
---
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscribe@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/groups/opt_out.

No comments: