Skip to content

Commit

Permalink
Merge branch 'master' into RB_1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
elson committed Oct 13, 2009
2 parents 435822f + 63944fa commit b8bb91b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions manualtests/widgets/autosuggest/index.html
Expand Up @@ -96,6 +96,7 @@ <h2>Autosuggest with minimum input length, and completion</h2>
}
},
complete: true,
selectCompletedText: false,
activeOnShow: false,
delim: " ",
theme: urlOpts.theme,
Expand Down
8 changes: 7 additions & 1 deletion src/widgets/autosuggest/autosuggest.js
Expand Up @@ -610,6 +610,7 @@
@param {Boolean} [opts.useCache=false] Allow results to cache when using a url dataSource
If false, a random number will be added to the URL to ensure the
results do not come from the browser's cache.
@param {Boolean} [opts.selectCompletedText=true] Set to false to prevent the widget from highlighting the completed text in the input element by selecting it.
@param {Function} [opts.onItemSelect] Your own handler for the itemSelect event.
@param {Function} [opts.onDataLoad] Your own handler for the dataLoad event.
Expand Down Expand Up @@ -746,6 +747,9 @@
}
);
}

this.opts.selectCompletedText =
(opts.selectCompletedText === undefined)? true : opts.selectCompletedText;
}

/* public fields *************************************************************/
Expand Down Expand Up @@ -988,7 +992,9 @@
var value = appendTag(currentValue, delim, suggested);
this.inputElement.val(value);

selectRange(this.inputElement[0], {start: (this._value || '').length, end: this.inputElement.val().length}); //currentValue.length+suggested.length})
if (this.opts.selectCompletedText) {
selectRange(this.inputElement[0], {start: (this._value || '').length, end: this.inputElement.val().length}); //currentValue.length+suggested.length})
}
}

/**
Expand Down

0 comments on commit b8bb91b

Please sign in to comment.