开发者

will_paginate ajax pagination with thinking sphinx

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开发者_StackOverflow社区_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?


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.

= will_paginate(@results, :params=>{"query"=> params[:query]})
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜