Skip to content
This repository has been archived by the owner on May 9, 2018. It is now read-only.

Feature request: receive the full "tag" object instead of either the tag value or label #41

Closed
sfmskywalker opened this issue Jun 9, 2012 · 7 comments

Comments

@sfmskywalker
Copy link

The "tagsChanged" event passes either the tag's value (if available) or the tag's label. In my use case this is somewhat bothersome, because when the user adds a tag that is not yet part of the tag source, I receive a label. If the tag is already part of the tag source, I receive its value. As far as I know there is no easy way to know wether I receive a value or a label. So perhaps it would be good to receive the full tag object as a third parameter? E.g.

var onTagsChanged = function (labelOrValue, action, tagObject) {

   alert ("label: " + tagObject.label + ", value: " + tagObject.value );

 };
@hailwood
Copy link
Owner

Actually that is the way that the function works now!

You will receive an object for that param that looks something like

{
    label: 'label',
    value: 'value',
    element: [Dom Element] // represents the actual dom element for that tag
}

@sfmskywalker
Copy link
Author

Awesome, I'll check it out! Thanks.

@sfmskywalker
Copy link
Author

I just checked, but when I remove a tag, null is passed as the 3rd argument. Looking at the invoking code in the _popTag function, it makes sense:

this.options.tagsChanged(tag.value || tag.label, 'popped', null);

null is explicitly passed.
Any reason why the actual popped tag is not being passed in?

@hailwood
Copy link
Owner

There we go, just updated it so it passes the tag through (a8bed19).

I guess I did it because in the tag object there is also the index of the tag, and the actual element, both of which make no sense once the tag has been removed, but I guess people can just ignore those.

@sfmskywalker
Copy link
Author

Yeah that makes sense. The reason I need the tag object is to update other elements on the screen that are related to the tag being removed.

Thanks for the quick response.

@hailwood
Copy link
Owner

All good, I try :) btw, out of curiosity, what version are you using? the ThemeRoller version or the non-ThemeRoller version?

@sfmskywalker
Copy link
Author

Excellent :) Currently I'm using the non-ThemeRoller one, since the default style is perfect for my needs (I manually changed some colors and borders). It's also the first time I used this (rather awesome) plugin, it's being used for the next version of the Orchard Taxonomies module.

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

No branches or pull requests

2 participants