-
Notifications
You must be signed in to change notification settings - Fork 70
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
Trigger a "tagRemoved" event to satisfy a use case where the "Save" butto #11
Conversation
…utton is disabled until the tags are actually modified. There is a transformToTag event which is very handy, but until now no event fires when a tag is removed. Signed-off-by: Steven Black <steveb@stevenblack.com>
Thanks Steven, I'll merge this tomorrow and maybe add some more events. Oliver |
Hi Steven, I had a look on your changes. Maybe I did not get the point but how do you bind something on the event? You put the trigger on the autocompleter in case of backspace, on the list element in case of finishing the editing and clicking the cross. |
Assuming a jQuery-ui button, $tagSubmit.button( { icons: { primary: "ui-icon-check" }, disabled: true } );
$( document ).bind( "transformToTag tagRemoved", function(){
$tagSubmit.button( "enable" );
}); We can bind to any parent container. Event bubbling takes care of the rest. Works like a charm! |
My question was regarding the tagedit plugin. Not how to bind a even in general. How do you bin this even from the tagedit plugin? |
You can bind to "#tagedit-input", no? |
Yes. But this would in your case only work when pressing Backspace. When clicking the delete button (not in edit mode) the event will not fire because there "$(this)" is the li-Element. Nevertheless I think it would be more comfortable binding the event on the tagedit Element or giving the with the options. |
Sure, whatever works. I didn't have a use case for binding from within the plugin, just from a view manager outside the plugin. What's your use case for needing it inside the plugin? Just wondering. |
Hey so any more thoughts on this? I'm depending on tagRemoved now so maybe my instance is a diverged perma-fork? |
Hi, sorry completly busy the last week. I'll answer in about an hour. |
My idea on putting events on the plugin was to do something like this (like in jquery UI): $('form input').tagedit();
$('form input').tagedit('newTagCreated', function() {alert('a new child was born')}); Where 'newTagCreated' ist the name of the event when the user adds an new tag. In my opinion, binding an event to an element that is part of the plugin (i.e. "#tagedit-input") is not, lets say, comfortable enough. |
I close this one because binding of events should be done in a different way. |
Trigger a "tagRemoved" event to satisfy a use case where the "Save" button is disabled until the tags are actually modified. There is a transformToTag event which is very handy, but until now no event fires when a tag is removed.
Signed-off-by: Steven Black steveb@stevenblack.com