-
Notifications
You must be signed in to change notification settings - Fork 68
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
Clear search results #29
Comments
Just for clarification, you want to have the search results be cleared after navigating away to another page where the search is not displayed anymore, right? I'll be sure to add this functionality through the API |
Yes that is correct. Thanks |
You can now clear the search like following: // index and id (is not required) are both blaze parameters:
// for example https://github.com/matteodem/meteor-easy-search#eseach
EasySearch.Components.clear(index, id); Remember that the input might still have its value, this is not taken care of since you don't have to use the esInput (in theory). Feel free to re-open if there's anything missing regarding this ticket |
Also I have not documented this since I'll be re-working most of the Components to make a proper faceted search possible, see #21 |
@matteodem you mentioned not documenting this yet, I am kind of confused on how or where exactly I should be calling |
yeah, it's with the components API: It would be instead of "on" or "get" just "clear" without any parameters on the instance. I forgot to document that, I'll add that soonish. |
Changed "Lanyon" for "Hyde" in the features paragraph
I can't get this working, EasySearch.Components doesn't seem to exist and I don't know what "index" or "id" should be? It's really important to automatically close the results list and clear the box when the user selects a result. I can't find any reference to 'clear' in the docs. |
I'm also wondering how to do this. Looking at the EasySearch object there is a EasySearch.Cursor.emptyCursor object but that is the closest thing i can find. How do you 'clear' the results with the new version?? thanks. |
I think this got forgotten with v2, it might make most sense to always reset "search results" as soon as the user navigates away. I'll implement it that way for now. |
Should have that behaviour now in latest version, please check it out. |
How do you do it?
or
? |
Do you want an explicit clear method? I did not add it but one way would be to use component methods to search for an empty string. |
Oh thats kind of genius haha, a dedicated method would be nice, but the empty string does the trick for now. |
I tried this:
but the search results stayed on screen. What am I doing wrong? Edit: I got it, I think. This works:
|
Note: I want to hide the list if the user presses 'Esc' or clicks outside the list, so they don't have to go into the input and delete the search term to hide the search list. So that's a use case for manually clearing the list. I haven't tried it yet but I expect that your suggestion of searching for empty string will work for this. |
I can't get this to work. I tried:
and
when I clear the search this way I just get all results, even though my search input component has noDocumentsOnEmpty=true:
|
I am not sure but is there an underlying function within the source code to explicitly reset the search input
esInput
and the search results. Users of my application have found the search results stale when they browse away from a route and I would like to reset it back or I should say run a clear, if that is possible ?The text was updated successfully, but these errors were encountered: