Haroenv/holmes

Is there a way to trigger filtering manually??

alvarosg88 opened this issue · 11 comments

Hi!

I'm trying to trigger Holmes filtering manually, but I can't found anything to do that in the docs.

My problem is that I'm rewriting the DOM elements to filter every X seconds with and AJAX request, and when I do, if I have a matching element on the search input, the DOM ignores this, of course, because I'm regenerating all the elements from a JSON response manually using Handlebars.

So that's the reason why I need some way to make the holmes filtering manually after Handlebars rewrites my DOM.

Is there any method on the docs that I'm missing or I'm asking for something impossible? hehehe

Regards!

Does setting dynamic: true help?

Nope, I've already tried and it doesn't work :(

Ah that sucks. Can you give me access to a codepen so I can recreate it?

Too much code for that, and that's property of my company. My boss would kick my ass for that hahahaha.

Anyway, don't worry. I'll try something different. Or just think about a way to call the "filtering process" manually instead of trigger it by keyboard input events.

I'll play around with the source code if I have some time and, if I can do something with that, I'll let you know.

Thanks for your time!

The relevant functions are h.stop().then(()=>h.start()) or taking a look at h._inputHandler

Great! I'll take a look on that. Thanks!

That's it! I tried with h._inputHandler and it works fine! Thank you!

That's cool! You fire that on-demand?

Yes. I refered the Holmes instance to a variable and triggered _inputHandler method manually on it after rewrite DOM. Nice!

Cool that this worked! Enjoy working with it

I just renamed this to h.search() and it's a public method now.

https://github.com/Haroenv/holmes/releases/tag/v1.17.0