Closed MaartenW closed 11 years ago
@MaartenW I just tested the current version and I see spliceTag()
being called as expected in the current version. Can you please create a JS Fiddle which reproduces your issue?
We changed this to use $el.find()
from a PR raised by @kenshin (ee4c607b47c6630e4523f1739354cf69be1d7503) related to errors happening if TagManager initializes before the DOM tree.
Hi Johnny, I can't seem to reproduce the error in JSFiddle so I'm sure it's on my side. Sorry I did not JSFiddle it before creating an issue here.
I now notice it actually has to do with the way one initializes tagManager.
If tagManager is initiated using the .each
method like this: (http://jsfiddle.net/gS9nV/3/)
$(document).ready(function(){
// Enable tagbox
$(".tm-input").each(function(){
$(this).tagsManager({
prefilled:$(this).val().split(','),
typeahead: true,
typeaheadSource: ["Gouden Kalf", "Cannes Palm", "Gouden Framboos", "Emmy Award", "Academy Award", "Tony Award", "Rembrandt Award", "Student Award","EFA Young Audience Award"
, "Vimeo Award", "Hivos Tiger Award", "IFFR Award", "BAFTA Award", "NFF Award", "Eurobest Award", "Nederlandse Academy Award", "Beeld en Geluid Award", "European Film Award",
"Joris Ivens Award"],
onlyTagList: true
});
})
});
Tags close as they should.
But initialized like this (directly, without the .each
method): (http://jsfiddle.net/gS9nV/2/)
$(document).ready(function(){
// Enable tagbox
$(".tm-input").tagsManager({
prefilled:$(this).val().split(','),
typeahead: true,
typeaheadSource: ["Gouden Kalf", "Cannes Palm", "Gouden Framboos", "Emmy Award", "Academy Award", "Tony Award", "Rembrandt Award", "Student Award","EFA Young Audience Award"
, "Vimeo Award", "Hivos Tiger Award", "IFFR Award", "BAFTA Award", "NFF Award", "Eurobest Award", "Nederlandse Academy Award", "Beeld en Geluid Award", "European Film Award",
"Joris Ivens Award"],
onlyTagList: true
})
});
tags appear on every tm-input and the close button doesn't work anymore. I'll search for a similar issue before opening a new one.
Don't know why but the spliceTag method is not attached to the onClick event. However, after simplifying the following:
To this: (replace
find
with regular selector and removeobj
from event binder)Everything works dandy.