John H
John H

Reputation: 61

In place editor with autocomplete

Has anyone been able to do this? Is it possible? I'm writing a Rails 3 app, and it seems like it should be possible to do this with jquery autocomplete and best-in-place, but I haven't seen it.

Upvotes: 6

Views: 948

Answers (2)

Aleks
Aleks

Reputation: 254

I used rails3-jquery-autocomplete. In view it'll be something like:

best_in_place @object, :name, :type => :input, 
  html_attrs: { "data-autocomplete" => your_autocomplete_path }

Upvotes: 2

Mik
Mik

Reputation: 4187

Too late for reply, but... I've just encountered with similar task and solved this problem like that:

#view
best_in_place @somewhat, :title, type: :input, inner_class: 'somewhat_title', 
  ok_button: 'ok', data: { autocomplete: true }

#coffee
$("span[data-autocomplete='true']").live 'click', ->
  $('.somewhat_title').autocomplete
    #usual autocomplete code here, nothing special

Upvotes: 3

Related Questions