-
Notifications
You must be signed in to change notification settings - Fork 610
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
Difficulty with data-multiple #16978
Comments
You must not use |
@vlazar I would consider this a bug, as it's very unexpected behavior. If someone re-initializes an awesomplete, we should destroy the old object and create a new one with their new settings. |
I'm also a little bit worried about automatically destroying existing Awesomplete instances. Since we can't control how it was initialized, should we just destroy old instances? Imagine the instance was created with JS. Then some |
Don't we already put an A Not sure I get what you mean about events. We have no way of knowing what user event listeners there are, so not sure how you propose removing them, even if we did agree that it would have been a good idea. |
There was a tiny PR #16868 but you opposed adding a property to inputs #16868 (comment)
I mean additional event handlers may add some functionality to the autocompleter itself (extend it). For this case we probably want to remove those event handlers when we automatically destroy existing instances. Or event handler may be just a way to communicate with some unrelated component on the page. In that case it's not belong to autocompleter itself and should not be automatically removed. Sadly we can't tell if event handler is part of custom autocompleter component or not. That's why I'm worried about automatic destroy. This may as well become confusing for some people. |
Guys, thanks for the help... It worked some time ago, I was in a hurry and I forgot to come back here to thank you. bye! |
Hi everyone,
I'm facing difficulties using data-multiple. During the last week I've been trying several approaches to make it work with no sucess.
I'm listing the content, but it is not inserting the comma and giving the option of a new select.
I've added in my application.js the following:
new Awesomplete('input[data-multiple]', { filter: function(text, input) { return Awesomplete.FILTER_CONTAINS(text, input.match(/[^,]*$/)[0]); }, replace: function(text) { var before = this.input.value.match(/^.+,\s*|/)[0]; this.input.value = before + text + ", "; } });
and in my _form.html.erb for this input, I'm using:
<%= f.text_field :objeto_de_acao, :class => 'awesomplete', :list => 'objetos', :data => { :multiple => ''} %> <datalist id="objetos"> <% action_objects_array.each do |action_object| %> <option><%= action_object[0].to_s %></option> <%end%> </datalist>
For what I've seen in the advanced examples, this is all I probably need to do. Am I missing anything?
thanks ins advance.
The text was updated successfully, but these errors were encountered: