Closed mervynteo closed 8 years ago
How did you try to put in the search components? Please give me the same html code with the components in there.
I do not see where you are using EasySearch.Each
to loop through the search results.
I left it out earlier as I did not make much changes to that part of the codes. Mixing both gave me errors so currently i stuck to easy-search layout for the Each loop but I hope to integrate it with FW7. Have added it above.
Please show me the errors
You can define attributes
on your input if you need special classes, I don't really understand what the problem here is.
The issue is merging the 2 search; have easy-search + FW7's formatting and bar functions/appearance. I hope to retain the clear search
and results notice
.
Is it possible to show how to fit the easy-search handlebar {{> EasySearch.Input index=myIndex}}
into the FW7's <input type='search' ....>
bar formatting?
You can override the type by simply having attributes have a key of type and a value of search
:
Template.myTemplate.helpers({
attributes: () => {
return { type: 'search', ... };
}
});
See source code here https://github.com/matteodem/meteor-easy-search/blob/master/packages/easysearch:components/lib/input/input.js#L55
Thanks @matteodem, great help again. With the template helper above, will the below be a correct understanding? Im using easy-search to search, but with FW7 clear and cancel buttons, as well as FW7 search bar UI formatting. Not sure how do I bring out in html the cancel and clear functions of FW7.
<form class="searchbar">
<div class="searchbar-input">
<!-- <input type="search" placeholder="Search"> FW7 input format, removed -->
{{> EasySearch.Input index=myIndex attributes=attributes}}
<a href="#" class="searchbar-clear"></a> <!-- need to remove? will it be in the {{>}}? -->
</div>
<a href="#" class="searchbar-cancel">Cancel</a> <!-- need to remove? will it be in the {{>}}? -->
</form>
Template.myTemplate.helpers({
attributes: function () {
return {
type: 'search',
placeholder: 'search here',
class: {
'searchbar-clear',
'searchbar-cancel'
}
};
}
});
the value of class should also be a string. Blaze can convert an object of string values to actual html attributes. Also the logic for clear and cancel can be implemented through component methods, please look them up in the docs.
Do you mean that for attributes, I can only define the type, placeholder and class (which is also just a string/name?). As for cancelling and clearing the search bar, I would have to create my own helpers?
You would need to use the component methods, which are in the docs.
Meteor-easy-search package uses a Blaze incorporated search input bar in the style below:
{{> EasySearch.Input index=myIndex}}
Im also using Framework7, which also has a search tool that is in this format.
So I tried to combine the 2 like this
I tried to insert the Blaze formatted easy-search bar and it [1] screws the formatting of Framework7 bar and [2] the easy-search does not work. Im trying to search by the header of the to-do item, as well as its contents. Also search results formatting clashes too.
How should I go about the implementation? Do I use both or pick one? Im looking through search through 2 collections, the posts and the messages parked under each post.