Ajax pagination with filters in cakephp

孤街浪徒 提交于 2019-12-04 19:57:38

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!