2012-03-25 40 views

Trả lời

3

Quá trễ để trả lời, nhưng ... Tôi vừa mới gặp phải với nhiệm vụ tương tự và giải quyết vấn đề này như thế:

#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 
2

tôi đã sử dụng rails3-jquery-autocomplete. Trong chế độ xem, nó sẽ giống như sau:

best_in_place @object, :name, :type => :input, 
    html_attrs: { "data-autocomplete" => your_autocomplete_path } 
Các vấn đề liên quan