sliptree / bootstrap-tokenfield

A jQuery tag/token input plugin for Twitter's Bootstrap, by the guys from Sliptree
http://sliptree.github.io/bootstrap-tokenfield/
Other
859 stars 238 forks source link

Pjax turbolinks app using tokenfield #233

Open amnesia7 opened 9 years ago

amnesia7 commented 9 years ago

My app uses tokenfield and I'm looking at using rails/turbolinks which uses pjax to do page changes.

I can destroy tokenfield if the user is clicking away from the page that tokenfield is on but this gives a flash of the comma-separated list in the tags field before page change.

If the user clicks the back button turbolinks reloads the page from cache, ie the tokenfield html still exists but the data applied to the tag field won't exist. This leaves me with half of tokenfield applied.

It doesn't seem to want to allow me to run 'destroy' first because I think that falls over because tokenfield hasn't actually been applied to the field, only the html changes will exist.

Any suggestions how I can get around this issue without unloading when leaving the page if possible?

Could the html changes be made only if they don't already exist so that calling tokenfield would just set it up without adding additional wrapper html etc to the field?

joshm1204 commented 5 years ago

Same issue here! Any solution?