私はこのスニペットを持っています:
$("#select_sourcer").autocomplete(
minLength: 2
source: "/admin/users/list_of_sourcers.json"
focus: (event,ui) ->
$('#select_sourcer').val(ui.item.full_name)
false
select: (event,ui) ->
$("#select_sourcer").val(ui.item.full_name)
$("#merchant_sourcer_id").val(ui.item.id)
false
).data("autocomplete")._renderItem = (ul, item) ->
$("<li></li>").data("item.autocomplete", item).append("<a>" + item.full_name_with_status + "</a>").appendTo ul
そして時々私はこのエラーを受け取ります:
未定義のプロパティ '_renderItem' を設定できません
だから私は、いつ:
$("#select_sourcer").autocomplete(...).data("autocomplete")
未定義です。属性を設定できません。このスレッドで話されているように: なぜこの JS エラーが発生するのですか?
しかし、Coffeescript で投票された回答を確認するにはどうすればよいでしょうか。