Replies: 1 comment 2 replies
-
ToggleRefinement is meant to set specifically disjunctive facet refinements, not numeric refinements. The way to go then would be a numeric menu like this: instantsearch.widgets.numericMenu({
container: '#price-list',
attribute: 'price',
items: [
{ label: 'past', start: Math.floor(Date.now() / 1000) },
{ label: 'future', end: Math.floor(Date.now() / 1000) },
],
}) https://codesandbox.io/s/green-darkness-7h5kj?file=/src/app.js If the rendering should be a single "checkbox", that could be implemented using the connector, however note that unlike toggle refinement, numeric refinement can't have a default value Sorry for the late reply here, it looks like discussions didn't show up in our issue tracking tool! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello,
I'm trying to use a
toggleRefinement
to enable or disable anumericFilter
. The use case is that I want to have a checkbox "Registrations open", that filters hits based on aregisterUntil
attribute, that contains a Unix timestamp.Another use case would be a checkbox "Finished events" that filters hits based on their date (ie
if date < now
).In terms of code, I would expect something like this to work:
What do you think? Is there a way to achieve this with the current
toggleRefinement
implementation? If not, what would be your recommended approach?Beta Was this translation helpful? Give feedback.
All reactions