-
Notifications
You must be signed in to change notification settings - Fork 823
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
SS4.3.0. Boolean not behaving properly in searchableFields. #8691
Comments
Confirmed locally. It can be replicated with just the generic private static $searchable_fields = array(
'SomeBooleanField'
); Enum are OK. SS4.2 search is OK as well. |
Some useful background info on #8708 (duplicate issue) |
Can confirm, issue is still happening on SS4.5. Current workaround:
|
need to update class DBBoolean scaffoldSearchField() and add null to the source array. |
This is still an issue in 4.7.3 ... |
Temporary fix here: useage: use Sunnysideup\YesNoAnyFilter\FixBooleanSearch;
class MyDataObject extends DataObject
{
use FixBooleanSearch;
} I tried to fix this in the core, but I can't seem to work out why the null value gets removed from the scaffolded Dropdown. |
Fixed by #9893 Awesome work! |
Affected Version
phpunit/phpunit 5.7.27 The PHP Unit Testing framework.
silverstripe-themes/simple 3.2.0 The SilverStripe simple theme (default SilverStripe 3 theme)
silverstripe/recipe-cms 4.3.0 SilverStripe recipe for fully featured page and asset content editing
silverstripe/recipe-plugin 1.3.0 Helper plugin to install SilverStripe recipes
Description
When using a Boolean
FeaturedOnHomepage
insearchableFields
, as above,(1) the dropdown only displays two options, "Yes" or "No", instead of three options, "Yes", "No", "Any" as it has done in prior versions of SS and which the lessons claims it should (see Lesson 13).
(2) when using the search form in the CMS, "Yes" appears as the default in the dropdown. If one does not select anything in the dropdown then a search returns records having
FeaturedOnHomepage
both "Yes" and "No", even though "Yes" appears to be selected, which is incorrect behaviour; it should return only those with value "Yes".(3) If one next selects "Yes" or "No" in the dropdown, a search returns records having
FeaturedOnHome
either "Yes" or "No", as selected, which is the appropriate behavior.(4) After (3), one can no longer get a list of all records; one can only get those with value "Yes" or those with value "No", ie, they are always filtered and there is no way to get back to the unfiltered list, except by reloading the page.
The text was updated successfully, but these errors were encountered: