あなたはそうのようなupdateChoicesメソッドを上書きしようとすることができます:
Ajax.Autocompleter.prototype.updateChoices = function (choices) {
if(!this.changed && this.hasFocus) {
if(!choices) {
//do your "new item" thing here
}
else {
this.update.innerHTML = choices;
Element.cleanWhitespace(this.update);
Element.cleanWhitespace(this.update.down());
if(this.update.firstChild && this.update.down().childNodes) {
this.entryCount =
this.update.down().childNodes.length;
for (var i = 0; i < this.entryCount; i++) {
var entry = this.getEntry(i);
entry.autocompleteIndex = i;
this.addObservers(entry);
}
} else {
this.entryCount = 0;
}
this.stopIndicator();
this.index = 0;
if(this.entryCount==1 && this.options.autoSelect) {
this.selectEntry();
this.hide();
} else {
this.render();
}
}
}
}
それはcontrols.jsに上書きするには良いideeaではありません。代わりに、これを新しい.jsに追加し、ライブラリの後に追加することができます。
EDIT:pff ..悪いインデントについては申し訳ありませんが、TextMateのコピー/ペーストであり、タブにはスペースが入ります。私はあなたがポイントを得ることを願っています。私が追加したのは、
if(!choices) {
//do your "new item" thing here
}
else {}
ブロックです。また、私はコードをテストしなかったが、うまくいくはずだと思う。
ありがとうございました。 最後に、私たちは同時に答えました! あなたのソリューションは私のものよりもきれいです。私はそれをどのように扱うことができるか見るためにそれをチェックするつもりです。 ありがとう;) – Yako