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

Create a filter component #342

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Create a filter component #342

wants to merge 1 commit into from

Conversation

AlexFrazer
Copy link

The docs mention how to make a filter component, so why not just include it?

Did this on my own project. Figured it could be useful for lots of people anyway.

Not sure how to update the docs.

@matteodem
Copy link
Owner

Awesome idea! I'll be sure to check it out soon

@matteodem
Copy link
Owner

Do you have a usage example with blaze?

@AlexFrazer
Copy link
Author

Yeah, it would look something like this:

{{>EasySearch.Filter property="status" options=statusOptions class="select fancy-select"}}

Where:

  • property is the property being set
  • options is a map of the options with a value and label, eg:
[{
  value: 0,
  label: 'New'
}, {
  value: 1,
  label: 'Accepted'
}]

Would usually be used with some sort of helper. Works best with aldeed:autoform and aldeed:simple-schema

Template.fancyForm.helpers({
  'statusOptions': function () {
    return Collection.simpleSchema().schema('status').autoform.options();
  }
});
  • everything else is passed to the html element.
One little catch

This only sets the property, but doesn't apply anything to the search. It expects people to customize their search engine as per the docs. Just provides the convenient HTML element and javascript.

@matteodem
Copy link
Owner

Still think this is a cool component, I'm just very busy right now with work but will look at it asap!

@matteodem
Copy link
Owner

probably kinda late but i'll merge this when you the adjustments are made! would be awesome to have this.

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

Successfully merging this pull request may close these issues.

None yet

2 participants