Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updater should not be triggered on move #382

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

updater should not be triggered on move #382

wants to merge 1 commit into from

Conversation

Serhioromano
Copy link

I know most probably you will not accept it but in original typeahead updater was triggered when the value was selected. To trigger it every time you change active element in the list without enter or tab is wrong.

For example, I use it like this

var input = $($.parseHTML($self.options.templates.input))
.attr({ placeholder: $self.options.placeholder })
.typeahead({
	source: function(query, process) {
		var suggestions = $.merge([], $self.options.suggestions);

		if ($self.options.suggestion_url) {
			$.ajax({
				dataType: "json",
				async: false,
				url: $self.options.suggestion_url,
				data: { q: query, limit: $self.options.suggestion_limit }
			}).done(function(json) {
				if (typeof json == "object") {
					suggestions = $.merge(suggestions, json);
					suggestions = $self._prepare(suggestions);
					suggestions = $self.options.onLoadSuggestions(suggestions);
					process(suggestions);
				}
			});
		} else {
			suggestions = $self._prepare(suggestions);
			suggestions = $self.options.onLoadSuggestions(suggestions);
			process(suggestions);
		}
	},
	updater: function(item) {
		console.log(item);
		$self._addTag(pills_list, input, item);
	}
});

whee $self._addTag(pills_list, input, item); add a new pill to the list, It is my shttps://github.com/Serhioromano/bootstrap-tags library. It is not super popular but has few stars there. If you do not accept I'll comment it locally and pack my library as a bundle with hacked version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant