Forum: Ruby on Rails ajax search feature works in FF but not IE

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
D6434aa0b7b350f8c3ed0119d81b2ead?d=identicon&s=25 Roy Pardee (rpardee)
on 2009-01-28 02:16
(Received via mailing list)
Hey All,

I put a simple search box on my projects/index view, via the following
observe_field call:

<%= observe_field('project_search',
    :url => { :controller => "projects", :action => "index_search"},
    :update => "project-list",
    :loading => "Element.show('search_spinner')",
    :complete => "Element.hide('search_spinner')",
    :frequency => 1,
    :submit => 'search') -%>

The index_search action queries out the proper set of projects & renders
the list to a partial, like so:

def index_search
  min_query_length = 1
  q = params[:project_search]

  if q.length > min_query_length then
    @projects = Project.find_by_name_fragment(q) || []
  else
    order_by = params[:order_by] || 'statuses.name'
    @projects = Project.find(:all, :order => order_by, :include =>
'status')
  end
  respond_to do |format|
    format.js do
      render :partial => "project_list.html.erb"
    end
  end
end

That partial renders a table w/one row per project.  This works just
fine from FireFox.  But from IE I don't get my table--just a blank page.
So the records that used to be in my table id="project-list" are gone,
but I don't see the new ones that index_search queried out of the db.
Judging from the log, IE is indeed making the request to index_search,
passing the params it should, etc.  The log even says, e.g.,

  Rendered projects/_project (0.01600)
  Rendered projects/_project_list.html.erb (0.10900)

But IE doesn't seem to want to actually *display* these guys.  FF's web
development toolbar tells me I'm in "standards compliance mode" when I
pull up a searched list of projects, so I believe the markup is all
kosher.

What am I doing wrong?

Thanks!

-Roy

Roy Pardee
Research Analyst/Programmer
Group Health Center For Health Studies (Cancer Research Network)
(206) 287-2078
Google Talk: rpardee
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 Mark Reginald James (Guest)
on 2009-01-28 03:07
(Received via mailing list)
Pardee, Roy wrote:

> <%= observe_field('project_search',
>     :url => { :controller => "projects", :action => "index_search"},
>     :update => "project-list",
> ...
> That partial renders a table w/one row per project.  This works just fine from FireFox. 
But from IE I don't get my table--just a blank page.  So the records that used to be in my 
table id="project-list" are gone, but I don't see the new ones that index_search queried 
out of the db.  Judging from the log, IE is indeed making the request to index_search, 
passing the params it should, etc.  The log even says, e.g.,
> ...
> But IE doesn't seem to want to actually *display* these guys.  FF's web development 
toolbar tells me I'm in "standards compliance mode" when I pull up a searched list of 
projects, so I believe the markup is all kosher.


:update changes the innerHTML of a node, so you will be inserting
the table inside the table tag.

Wrap a div around the table and update that instead.

--
Rails Wheels - Find Plugins, List & Sell Plugins -
http://railswheels.com
D6434aa0b7b350f8c3ed0119d81b2ead?d=identicon&s=25 Roy Pardee (rpardee)
on 2009-01-28 17:22
(Received via mailing list)
Fantastic!  That did the trick.  Thanks!
This topic is locked and can not be replied to.