timothyarmes / tag-list

Dynamic List handling for Meteor
MIT License
4 stars 2 forks source link

Error: one of local, prefetch, or remote is required #2

Open doubletaketech opened 9 years ago

doubletaketech commented 9 years ago

Timothy, Any idea why I keep getting this error? Exception from Tracker afterFlush function: Error: one of local, prefetch, or remote is required

I'm just passing an array to the Meteor.typeahead like in your example, but from a collection.

Template.itemForm.rendered = function(){

    var tags = Tags.find().fetch().map(function(it){ return it.tag; });

        Meteor.typeahead(this.find('#itemTags input'), tags)

};

<div class="form-group">
        <label>Tags</label>
            {{#if tagsExist tags}}
                {{> tagList id="itemTags" defaultItems=tags}}
            {{else}}
                {{> tagList id="itemTags"}}
            {{/if}}

    </div>

Thanks, Don

timothyarmes commented 9 years ago

Hi,

That's coming from typeahead, you need to pass it some options...

https://github.com/twitter/typeahead.js/blob/master/doc/jquery_typeahead.md#usage

On Tue, Jan 27, 2015 at 4:38 PM, Don Kerr notifications@github.com wrote:

Timothy, Any idea why I keep getting this error? Exception from Tracker afterFlush function: Error: one of local, prefetch, or remote is required

I'm just passing an array to the Meteor.typeahead like in your example, but from a collection.

Template.itemForm.rendered = function(){

var tags = Tags.find().fetch().map(function(it){ return it.tag; });

    Meteor.typeahead(this.find('#itemTags input'), tags)

};

{{#if tagsExist tags}} {{> tagList id="itemTags" defaultItems=tags}} {{else}} {{> tagList id="itemTags"}} {{/if}}

Thanks, Don

— Reply to this email directly or view it on GitHub https://github.com/timothyarmes/tag-list/issues/2.

doubletaketech commented 9 years ago

I'm using the same syntax you are in your example and I can't see how to pass these additional options you are referring to into your Meteor.typeahead() function? Meteor.typeahead(this.find('#my-id input'),?????,tags)

Meteor.typeahead(this.find('#my-id input'),
      ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California',
       'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii',
       'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana',
       'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota',
       'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire',
       'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota',
       'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island',
       'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont',
       'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'
      ]
   )};
timothyarmes commented 9 years ago

Hmm, this is true. I'm not sure then, perhaps the Meteor typeahead project's been modified since this was done?