diff --git a/taipy/gui_core/_adapters.py b/taipy/gui_core/_adapters.py index 7acf0e4919..db55c49fbf 100644 --- a/taipy/gui_core/_adapters.py +++ b/taipy/gui_core/_adapters.py @@ -15,6 +15,7 @@ import sys import typing as t from abc import ABC, abstractmethod +from collections.abc import Iterable from dataclasses import dataclass from datetime import date, datetime from enum import Enum @@ -246,6 +247,8 @@ def get_hash(): "contains": contains, } +def _filter_iterable(list_val: Iterable, operator: t.Callable, val: t.Any): + return next(filter(lambda v: operator(v, val), list_val), None) is not None def _invoke_action( ent: t.Any, col: str, col_type: str, is_dn: bool, action: str, val: t.Any, col_fn: t.Optional[str] @@ -260,6 +263,8 @@ def _invoke_action( if op := _operators.get(action): cur_val = attrgetter(col_fn or col)(ent) cur_val = cur_val() if col_fn else cur_val + if isinstance(cur_val, Iterable): + return _filter_iterable(cur_val, op, val) return op(cur_val.isoformat() if isinstance(cur_val, (datetime, date)) else cur_val, val) except Exception as e: if _is_debugging():