Can anybody give a best example of ajax pagination in cakephp 2.x.
This should include data filtering also.
I have read cakephp manual but could not understand much.
After a long search and work, i have developed a solution which is as follows:
Client Side:
- Fist of all create a form with all filtering options.
- Submit the form using ajax.
- Use Post method to submit the form.
- Submit the form using serialize method.
Server Side:
- All filter form data will be available in $this->request->data.
Set PaginatorHelper options as mentioned below:
$this->paginator->options(array(
'url' => $this->passedArgs, 'update' => 'element_id_to_be_updated', 'evalScripts' => true, 'data'=>http_build_query($this->request->data), 'method'=>'POST',
) );
'url' => $this->passedArgs
To post back all named arguments, when pagination links are clicked.'data'=>http_build_query($this->request->data)
To post back all post data, when pagination links are clicked.
来源:https://stackoverflow.com/questions/13429722/ajax-pagination-with-filters-in-cakephp