hailwood / jQuery-Tagit

The Jquery Tagit Plugin transforms an html unordered list into a unique tagging plugin.
264 stars 109 forks source link

Change the tag source on the fly #51

Closed acermez closed 7 years ago

acermez commented 12 years ago

Hi, nice jquery plugin.

i wonder if can reload the tag source once i added a new custom tag, i managed to save new tags in the database, but i will need to add the tags that i have just created to the tag source (autocomplete), cause i will need it again and i can't refresh the page (i use only ajax querys)

Please advise !! thank you.

UPDATE : i found a solution by changing the fill function :

    //newtagsource is an array passed form the fill call, it contains the label,value keys, generated from the database after i
   //insert a new tag, so the autocomplete will recognize it in the next add form 

    fill:function (tags, newtagsource) {
        if (tags !== undefined)
            this.options.initialTags = tags;

        $(".tagit-input").autocomplete( "option" , "source" , newtagsource )
        this.reset();
    },
slavkaa commented 9 years ago

You can access options via $('#myTags').data("ui-tagit").options