views:

49

answers:

1

On the homepage of my web app I'm implementing pagination with ajax as well as an autocomplete search.

The script I used for the ajax pagination is here: http://wiki.github.com/mislav/will_paginate/ajax-pagination

The script I used for autocomplete search is detailed in my own answer to this question: http://stackoverflow.com/questions/1911077/rails-autocomplete-tag-search-filter/1925020#1925020

Each of these function just fine separately, but they don't work at all together. I believe this has something to do with the controller code but I'm not sure what.

I tried doing this but it didn't work:

format.js do

    #For Auto complete
    render :inline => "<%= auto_complete_result(@search_tags, 'name') %>"

    #For Pagination with ajax    
    render :update do |page|
        page.replace 'result', :partial => "search results"
    end

end

If I comment out auto complete, pagination with ajax works. If I comment out pagination with ajax the autocomplete works.

What should I be doing here to make both of them work?

+1  A: 

I've taken a look around, and it doesn't look like you can call render twice. It could be passing back an error page instead of a js file, so you don't actually get to see the error, but the features don't work. You'll probably just have to mash the two render calls into one somehow, maybe manually?

thenoviceoof
sorry, didn't see your comment
thenoviceoof