-
-
Notifications
You must be signed in to change notification settings - Fork 88
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
Filters #103
Comments
Adding 'AND' for empty values are fixed. but since |
Sounds good thanks. It would be awesome if there was an exact match function so I don't have to define my own function |
$dt->forceExactMatch(true);
I haven't tested it completely but I think it should work like this. $dt->filter('test_test', function () {
if ($this->searchValue() === '') {
return '';
}
$val = explode('-delim-', $this->searchValue());
return $this->between($val[0], $val[1] ?? null);
}, \Ozdemir\Datatables\CustomFilterType::INDIVIDUAL);
$dt->filter('test_test', function () {
if ($this->searchValue() === '') {
return '';
}
$val = explode('-', $this->searchValue());
return $this->between($val[0], $val[1] ?? null);
}, \Ozdemir\Datatables\CustomFilterType::GLOBALLY); |
When I have multiple filters and one is empty it still adds AND to the query and causes a pdo error. If all filters have values or if only one filter is defined the query works.
Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND )t'
The text was updated successfully, but these errors were encountered: