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

Header and footer support #128

Open
TannerMeng opened this issue Oct 30, 2015 · 1 comment
Open

Header and footer support #128

TannerMeng opened this issue Oct 30, 2015 · 1 comment

Comments

@TannerMeng
Copy link

First it works great. thanks for the great package.
I've one usability issue.
data-template is applied to each item in db colletion or array.
We have no way to specify the footer that says "No match? Please click here"
Is there a way to give the header & footer (clickable)?
Thanks

@trungvt
Copy link

trungvt commented May 29, 2016

I resolved this problem by setting up the dataset for text input, follow the docs of Multiple datasets.

<template name="demo">
  <div class="form-group">
    <input class="form-control typeahead" name="team" type="text"
           placeholder="NBA and NHL teams"
           autocomplete="off" spellcheck="off"
           data-sets="teams"/>
  </div>
</template>

<template name="team">
    <h4><i>{{name}}</i></h4>
</template>

<template name="footer">
    <div class="tt-suggestion tt-selectable">
    <p class="repo-language">
      <a href="#" style="color: #000000;">
        View more...
      </a>
    </p>
  </div>
</template>

<template name="header">
    <h3 class="league-name">NBA Teams</h3>
</template>
Template.demo.helpers({
  teams: function() {
    return [
      {
        name: 'nba-teams',
        valueKey: 'name',
        local: function() { return Nba.find().fetch(); },
        header: 'header',
        footer: 'footer',
        template: 'team'
      }
    ];
  }
});

Then you catch the click event of a tag in footer, etc. It's up to your view content. :)

janat08 pushed a commit to janat08/meteor-typeahead that referenced this issue Apr 12, 2018
Add displayKey as valid option in docs
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

2 participants