bootstrap-tags icon indicating copy to clipboard operation
bootstrap-tags copied to clipboard

Passing Ids as well as getting Ids

Open ghost opened this issue 11 years ago • 1 comments

Hi,

I was wondering if this library supports the ability to pass Ids to each tag as well as getting those passed Ids from the getTags function?

Estentially, what I want to do is pass the tags names and ids for the tags in the initialization. (e.g. $('#tags').tags({suggesstions: [ 'All', 'Accounting', 'Management' ], restrictTo: [ 'All', 'Accounting', 'Management' ], tagIds: [ '1', '2', '3' ] });)

And then would it be possible, using the getTags() function or another function (e.g. getTagIds()), to retrieve those ids as well as the tag names.

This would be very helpful if you could provide a solution for this to me. I would very much like to use this library, but I need it to support Ids.

Thanks!

~ Tyler

ghost avatar Apr 17 '14 14:04 ghost

Hi Tyler --

I've thought about this before. I'm hesitant to try and fit that in to the existing code base (it's due for a significant refactor/rewrite). It raises questions for me about how it would support adding new tags (versus just managing existing ones) -- how would it find the id value for a not previously existent tag? I've considered having the library support RESTful conventions for tag saving/loading (when provided a route prefix), but I'm not sold on the idea.

For the time being, could you do something like:

http://jsfiddle.net/FFe2M/1/ (see the bottom of the js portion)

Where you use a tag -> id mapping?

maxwells avatar Apr 20 '14 20:04 maxwells