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

fix cleanFilter() bug and auto-initialize filters parameter #212

Conversation

bdelamatre
Copy link
Contributor

@bdelamatre bdelamatre commented Apr 18, 2021

  • commented out $this->cleanFilters() on getRowsQueryProperty(). Filtering was broken in my environment and this was the cause. I couldn't figure out why this would be here so I commented it out.
  • added mountWithFilters which will auto-initialize $filters from filters(). This removes the requirement to define $filters and filters().

@rappasoft
Copy link
Owner

rappasoft commented Apr 18, 2021

https://github.com/rappasoft/laravel-livewire-tables/blob/master/src/Traits/WithFilters.php#L40 cleanFilters makes sure the option being selected exists in the list of options you allow, to prevent any SQL security issues.

Also if you don't define $filters, how can you set defaults?

@bdelamatre
Copy link
Contributor Author

Ahh, that gives me more to go off, thanks. I bet there is something like a typecasting mismatch. I will dig further.

You can still define $filters if you have defaults, it only defines them on mount if they are missing. I suppose we could add a default field to the fields() definition. It's not necessary, but that would keep the entire filters definition in one place.

@bdelamatre bdelamatre closed this Apr 19, 2021
@bdelamatre
Copy link
Contributor Author

Replaced with #213

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

Successfully merging this pull request may close these issues.

2 participants