Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appendCurrent doesnt seem to do anything #27

Closed
syropian opened this issue Jul 26, 2016 · 9 comments
Closed

appendCurrent doesnt seem to do anything #27

syropian opened this issue Jul 26, 2016 · 9 comments
Labels

Comments

@syropian
Copy link
Contributor

I'm having trouble appending/replacing the items. Here's a little JSFiddle https://jsfiddle.net/jrpar74q/

Am I missing something obvious? I tried passing true as a second arg to replace the items, and that didn't work either.

@mrsweaters
Copy link
Collaborator

appendCurrent only works if there is an active instance of Tribute, meaning that someone has typed a trigger character and the menu is visible. Use append if there is no active instance.

@syropian
Copy link
Contributor Author

@mrsweaters Looking at the source, it looks like both append() and appendCurrent() call a private _append() function that always checks if the menu is visible (see https://github.com/zurb/tribute/blob/master/src/Tribute.js#L251-L259)

@mrsweaters
Copy link
Collaborator

Ah! You are correct, that should actually be specific to appendCurrent. This is a bug.

@mrsweaters mrsweaters added the bug label Jul 26, 2016
@syropian
Copy link
Contributor Author

syropian commented Jul 26, 2016

Cool, thanks for confirming! I'm currently working on a VueJS wrapper for Tribute, so due to the way data would be passed to the plugin, I can simply manually replace all the data whenever it changes, doing something like:

setValues(values){
  // If it has a "values" property, it's actually a collection
  if( values.hasOwnProperty("values") ){
    this.tribute.collection = values;
  }
  else {
    this.tribute.collection[0].values = values;
  }
}

@mrsweaters
Copy link
Collaborator

@syropian Yeah that should work. Thanks for working on a wrapper for VueJS! When you're done, feel free to submit a PR to add it to the repo. That would be sweet!

@mrsweaters
Copy link
Collaborator

Fixed in 2.0.3!

@syropian
Copy link
Contributor Author

Will do, how do you want me to go about creating a PR? Just a link in the README to the wrapper repo?

@mrsweaters
Copy link
Collaborator

Sure, that will be fine.

@ko06
Copy link

ko06 commented Jun 17, 2020

setValues(values){ // If it has a "values" property, it's actually a collection if( values.hasOwnProperty("values") ){ this.tribute.collection = values; } else { this.tribute.collection[0].values = values; } }

it works but the menu still holding old data, once close it and open means its working fine, how to update forcefully?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants