fix: preserve original data type when un-setting filter choices
This commit is contained in:
parent
485c503212
commit
cd1c536555
1 changed files with 7 additions and 2 deletions
|
|
@ -189,6 +189,10 @@ class GridFilter: # pylint: disable=too-many-instance-attributes
|
||||||
self.app = self.config.get_app()
|
self.app = self.config.get_app()
|
||||||
self.label = label or self.app.make_title(self.key)
|
self.label = label or self.app.make_title(self.key)
|
||||||
|
|
||||||
|
# remember original data type in case we need to revert,
|
||||||
|
# e.g. after changing it to 'choices' and back again
|
||||||
|
self.original_data_type = self.data_type
|
||||||
|
|
||||||
# active
|
# active
|
||||||
self.default_active = default_active
|
self.default_active = default_active
|
||||||
self.active = self.default_active
|
self.active = self.default_active
|
||||||
|
|
@ -201,7 +205,7 @@ class GridFilter: # pylint: disable=too-many-instance-attributes
|
||||||
self.verb = None # active verb is set later
|
self.verb = None # active verb is set later
|
||||||
|
|
||||||
# choices
|
# choices
|
||||||
self.set_choices(choices or {})
|
self.set_choices(choices)
|
||||||
|
|
||||||
# nullable
|
# nullable
|
||||||
self.nullable = nullable
|
self.nullable = nullable
|
||||||
|
|
@ -304,7 +308,8 @@ class GridFilter: # pylint: disable=too-many-instance-attributes
|
||||||
self.data_type = "choice"
|
self.data_type = "choice"
|
||||||
else:
|
else:
|
||||||
self.choices = {}
|
self.choices = {}
|
||||||
self.data_type = "string"
|
if self.data_type == "choice":
|
||||||
|
self.data_type = self.original_data_type
|
||||||
|
|
||||||
def normalize_choices(self, choices):
|
def normalize_choices(self, choices):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue