Dave Dumaresq wrote:
> I have three fields in a row above a grid of data and I'd like to use
> autocomplete in these fields; however, the selection list appears
> *behind* my data grid, which hides the list.
> 
> Any suggestions about how to override autocomplete css? I've tried
> plunking some style code into my view template, but it doesn't seem to
> have any effect.
> 
> There must be some competing autocomplete styles that are winning
> out.
> 
> Thanks for your help!
> Dave

I had the same symptom of the auto-completion list items appearing 
behind fields that were immediately below the auto-complete field. I was 
retrofitting to an existing app with a couple of convoluted style 
sheets. One sheet had an item with "z-index 10". I set new style sheet 
items for auto-complete with "z-index 100" which fixed my problem.

View form snippet:
<div class="formField">
  <!--%= token_tag method = get below fixed authenticity problem %-->
  <%= text_field_with_auto_complete :article, :contains, { :size => 15 
}, :skip_style => true, :method => :get -%>
</div>

Controller snippet:
def auto_complete_for_article_contains
  @articles = ["a", "b", "c" ]
  render :partial => "live/autosearch"
end

Partial snippet:
<ul>
  <% for article in @articles -%>
      <ul class="autocomplete_item"><%= h article.to_s %></ul>
  <% end -%>
</ul>

CSS snippet
.auto_complete {
  background-color: gray;
  z-index: 100;
}
ul.selected { background-color: blue; }
-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to