Skip to content
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

How to set the filter text externally #861

Open
Debananda opened this issue Jul 30, 2019 · 1 comment
Open

How to set the filter text externally #861

Debananda opened this issue Jul 30, 2019 · 1 comment

Comments

@Debananda
Copy link
Contributor

I have to preserve the filter during page navigation. I was going through https://github.com/GriddleGriddle/Griddle/blob/master/src/components/Filter.js, but did not found any way to set the filter text externally. Below snippet filter the data properly but doesn't set the filter text. Need some indicators to proceed

store.dispatch({
type: 'GRIDDLE_SET_FILTER',
filter: this.props.filterText
});

@dahlbyk
Copy link
Contributor

dahlbyk commented Jul 31, 2019

<Griddle filter={...} /> works for setting the initial filter state; however, the default Filter component does not receive its initial value from state. I can't think of a reason we wouldn't want to fix that, if anyone's up for a PR. (Yes, I'm planning to start reviewing PRs again!)

In the meantime, you can replace the Filter component with one that does default to the initial filter: https://codesandbox.io/s/griddle-issue-861-zh7gp.

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

No branches or pull requests

2 participants