diff --git a/vizro-core/docs/pages/user_guides/actions.md b/vizro-core/docs/pages/user_guides/actions.md index 6c2d2f87c..a12dc4484 100644 --- a/vizro-core/docs/pages/user_guides/actions.md +++ b/vizro-core/docs/pages/user_guides/actions.md @@ -113,7 +113,7 @@ To configure this figure interaction follow the steps below: ```py actions=[vm.Action(function=filter_interaction(targets=["scatter_relation_2007"]))] ``` -2. If the source figure is [`Graph`][vizro.models.Graph], enter the filter columns in the `custom_data` argument of the underlying source chart `function` if the source figure is [`Graph`][vizro.models.Graph]. +2. If the source figure is [`Graph`][vizro.models.Graph], enter the filter columns in the `custom_data` argument of the underlying source chart `function`. ```py Graph(figure=px.scatter(..., custom_data=["continent"])) ``` diff --git a/vizro-core/src/vizro/actions/_action_loop/_build_action_loop_callbacks.py b/vizro-core/src/vizro/actions/_action_loop/_build_action_loop_callbacks.py index 08526dfb1..94f2789d9 100644 --- a/vizro-core/src/vizro/actions/_action_loop/_build_action_loop_callbacks.py +++ b/vizro-core/src/vizro/actions/_action_loop/_build_action_loop_callbacks.py @@ -28,10 +28,10 @@ def _build_action_loop_callbacks() -> None: actions_chain_trigger_component_id = actions_chain.trigger.component_id try: actions_chain_trigger_component = model_manager[ModelID(str(actions_chain_trigger_component_id))] - # Use underlying 'Datatable' object as a trigger component. + # Use underlying table object as a trigger component. if isinstance(actions_chain_trigger_component, Table): actions_chain_trigger_component_id = actions_chain_trigger_component._underlying_table_id - # Not all action_chain_trigger_components are included in model_manager. eg on_page_load_action_trigger + # Not all action_chain_trigger_components are included in model_manager e.g. on_page_load_action_trigger except KeyError: pass diff --git a/vizro-core/src/vizro/actions/_actions_utils.py b/vizro-core/src/vizro/actions/_actions_utils.py index 77515e02a..62cc62081 100644 --- a/vizro-core/src/vizro/actions/_actions_utils.py +++ b/vizro-core/src/vizro/actions/_actions_utils.py @@ -70,7 +70,7 @@ def _apply_chart_filter_interaction( if not ctd_click_data["value"]: return data_frame - source_chart_id = ctd_click_data["id"] + source_chart_id: ModelID = ctd_click_data["id"] source_chart_actions = _get_component_actions(model_manager[source_chart_id]) try: custom_data_columns = model_manager[source_chart_id]["custom_data"] # type: ignore[index] @@ -108,7 +108,7 @@ def _apply_table_filter_interaction( try: source_table_actions = _get_component_actions(model_manager[source_table_id]) except KeyError: - # source_table_id is dash.Datatable id and we need to fetch actions from parent Vizro.Table component + # source_table_id is underlying table id, so actions from parent Vizro.Table component should be considered. source_table_actions = _get_component_actions(_get_parent_vizro_table(source_table_id)) for action in source_table_actions: diff --git a/vizro-core/src/vizro/actions/_callback_mapping/_callback_mapping_utils.py b/vizro-core/src/vizro/actions/_callback_mapping/_callback_mapping_utils.py index c24c6ec77..ec407ed69 100644 --- a/vizro-core/src/vizro/actions/_callback_mapping/_callback_mapping_utils.py +++ b/vizro-core/src/vizro/actions/_callback_mapping/_callback_mapping_utils.py @@ -152,7 +152,7 @@ def _get_action_callback_inputs(action_id: ModelID) -> Dict[str, Any]: "filter_interaction": ( _get_inputs_of_chart_interactions(action_id=action_id, action_function=filter_interaction.__wrapped__) if "filter_interaction" in include_inputs - else {} + else [] ), "theme_selector": (State("theme_selector", "on") if "theme_selector" in include_inputs else []), } diff --git a/vizro-core/src/vizro/models/_components/table.py b/vizro-core/src/vizro/models/_components/table.py index ba1a29681..d9fd9e972 100644 --- a/vizro-core/src/vizro/models/_components/table.py +++ b/vizro-core/src/vizro/models/_components/table.py @@ -78,14 +78,12 @@ def pre_build(self): @_log_call def build(self): # TODO: We also need to take case what empty object we need to create here once we support AgGrid and others. - dash_datatable_object = ( - dash_table.DataTable(id=self._underlying_table_id) if self.actions else dash_table.DataTable() - ) - return html.Div( [ html.H3(self.title, className="table-title") if self.title else None, - html.Div(dash_datatable_object, id=self.id), + html.Div( + dash_table.DataTable(**({"id": self._underlying_table_id} if self.actions else {})), id=self.id + ), ], className="table-container", )