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

Full JSON object string is displayed in typeahead input when selecting a result #133

Open
valtrem opened this issue Nov 20, 2015 · 5 comments

Comments

@valtrem
Copy link

valtrem commented Nov 20, 2015

When using meteor-typeahead with meteor MongoDb Collection, the full JSON object String is displayed in the input field when going through the search results with up/down keys.

For example, this shows up in the input field :
{"_id":"AtsygsnvRrTbBF8rq","key":"decisionMaking","nameFr":"Aisance dans la prise de décisions","nameEn":"Ease in decision making"}

I would expect the input to only display : "Aisance dans la prise de décisions" when using data-value-key="nameFr" for instance.

Here is my code :

  <input class="form-control typeahead" type="text"
                       placeholder="{{_ "selectSkillAptitudeProfession"}}"
                       autocomplete="off" spellcheck="off"
                       data-sets="skillsAptitudesProfessionsDS" data-select="selected"
                       data-value-key="nameFr" />
Template.profile.helpers({
    skillsAptitudesProfessionsDS: function() {
        return [
            {
                name: 'skills',
                valueKey: 'nameFr',
                local: function(){ return Skills.find().fetch()},
                header: '<b>'+TAPi18n.__("occupationSkills")+'</b>',
                template: 'autoCompleteResults'
            } ];
    }
});
@oskareke
Copy link

oskareke commented Dec 9, 2015

+1 Same problem here..

@AlekhyaYelchuru
Copy link

Same problem here..

@carrnivore
Copy link

You need to specify displayKey:'nameFr' for example

@renegade7
Copy link

Thank you @carrnivore, problem solved.

@Kiel-H-Byrne
Copy link

Ah thanks!

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

No branches or pull requests

6 participants