在cakephp中使用过滤器进行Ajax分页 [英] Ajax pagination with filters in cakephp

查看:71
本文介绍了在cakephp中使用过滤器进行Ajax分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以在cakephp 2.x中给出最佳的ajax分页示例。

Can anybody give a best example of ajax pagination in cakephp 2.x.

这还应该包括数据过滤。

This should include data filtering also.

我已阅读cakephp手册,但不太了解。

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:

客户端:


  • 拳头全部创建具有所有过滤选项的表单。

  • 使用ajax提交表单。

  • 使用Post方法提交表单。

  • 使用序列化方法提交表单。

  • 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.

服务器端:


  • 所有过滤器表单数据将在$ this-> request-> data中提供。

  • 按如下所述设置PaginatorHelper选项:

  • All filter form data will be available in $this->request->data.
  • Set PaginatorHelper options as mentioned below:

$ this-> paginator-> options(array(

$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 要在单击分页链接时发回所有命名的参数。

'url' => $this->passedArgs To post back all named arguments, when pagination links are clicked.

'data'=> http_build_query($ this-> request-> data)当单击分页链接时,要发回所有帖子数据。

'data'=>http_build_query($this->request->data) To post back all post data, when pagination links are clicked.

这篇关于在cakephp中使用过滤器进行Ajax分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆