Skip to content

Create a filter component - #342

Open
AlexFrazer wants to merge 1 commit into
matteodem:masterfrom
AlexFrazer:master
Open

Create a filter component#342
AlexFrazer wants to merge 1 commit into
matteodem:masterfrom
AlexFrazer:master

Conversation

@AlexFrazer

Copy link
Copy Markdown

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
Copy Markdown
Owner

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

@matteodem

Copy link
Copy Markdown
Owner

Do you have a usage example with blaze?

@AlexFrazer

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

2 participants