will_paginate ajax 分页与思考 sphinx
有没有人尝试过通过ajax对思考的狮身人面像结果集进行分页?
我在我的控制器操作中有这个:
@results = Model.search params[:query], :page => params[:page] || 1, :per_page => 1
在我的 application.js 中:
$(".pagination a").live("click", function() {
$.get(this.href, null, null, "script");
return false;
});
现在,我已经尝试过这个,这对于正常的活动记录分页是有效的,如下所示:
@results = Model.paginate(:page => params[:page] || 1, :per_page => 1)
但是如果我使用thinking-sphinx来获取记录,ajax分页会失败。我错过了什么吗?
Has anyone ever tried paginating a thinking sphinx result set thru ajax?
I have this is in my controller action:
@results = Model.search params[:query], :page => params[:page] || 1, :per_page => 1
and in my application.js:
$(".pagination a").live("click", function() {
$.get(this.href, null, null, "script");
return false;
});
Now, I have tried this and this works for normal active record pagination like so:
@results = Model.paginate(:page => params[:page] || 1, :per_page => 1)
But if I use thinking-sphinx for getting the records the ajax pagination fails. Am I missing something?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我已经得到了这个。但对于下一个可能遇到此问题的人来说,您所要做的就是确保链接也传递查询的参数。
I got this already. But for the next one who might encounter this problem, all you have to do is to make sure that the links also pass the params for the query.