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

Extended the server rules to use 'subscriptionParams' object. This ob… #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ Template.foo.helpers({
- `token`: (optional) What character should trigger this rule. Leave blank for whole-field behavior (see below).
- `collection`: What collection should be used to match for this rule. Must be a `Mongo.Collection` for client-side collections, or a string for remote collections (available in `global` on the server.)
- `subscription`: A custom subscription for server-side search; see below.
- `subscriptionParams` - additional information required by the publication function, i.e. providing additional data for accessing external APIs (like token, etc)
- `template`: The template that should be used to render each list item.
- `filter`: (optional) An object that will be merged with the autocomplete selector to limit the results to more specific documents in the collection.
- `sort`: (default `false`) Whether to sort the results before applying the limit. For good performance on large collections, this should be turned on only for server-side searches where an index can be used.
Expand Down
3 changes: 2 additions & 1 deletion autocomplete-client.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ class @AutoComplete
# console.debug 'Subscribing to <%s> in <%s>.<%s>', filter, rule.collection, rule.field
@setLoaded(false)
subName = rule.subscription || "autocomplete-recordset"
subscriptionParams = rule.subscriptionParams || rule.collection
@sub = Meteor.subscribe(subName,
selector, options, rule.collection, => @setLoaded(true))
selector, options, subscriptionParams, => @setLoaded(true))

teardown: ->
# Stop the reactive computation we started for this autocomplete instance
Expand Down