From 853a43eaabafa98478e3ce8a35bb938745580824 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Brand=C3=A9ho?= Date: Wed, 1 Nov 2023 01:07:28 +0100 Subject: [PATCH] fix portal when using multiple datatable (#2094) --- reflex/components/datadisplay/dataeditor.py | 41 ++++++++------------- 1 file changed, 16 insertions(+), 25 deletions(-) diff --git a/reflex/components/datadisplay/dataeditor.py b/reflex/components/datadisplay/dataeditor.py index cab6020c4..7edb7e580 100644 --- a/reflex/components/datadisplay/dataeditor.py +++ b/reflex/components/datadisplay/dataeditor.py @@ -316,44 +316,35 @@ class DataEditor(NoSSRComponent): props["theme"] = DataEditorTheme(**theme) # Allow by default to select a region of cells in the grid. - props.setdefault("getCellForSelection", True) + props.setdefault("get_cell_for_selection", True) # Disable on_paste by default if not provided. - props.setdefault("onPaste", False) + props.setdefault("on_paste", False) - if props.pop("getCellContent", None) is not None: + if props.pop("get_cell_content", None) is not None: console.warn( - "getCellContent is not user configurable, the provided value will be discarded" + "get_cell_content is not user configurable, the provided value will be discarded" ) grid = super().create(*children, **props) return Div.create( grid, - Div.create(id="portal"), width=props.pop("width", "100%"), height=props.pop("height", "100%"), ) - # def _render(self) -> Tag: - # if isinstance(self.data, Var) and types.is_dataframe(self.data.type_): - # self.columns = BaseVar( - # name=f"{self.data.name}.columns", - # type_=List[Any], - # state=self.data.state, - # ) - # self.data = BaseVar( - # name=f"{self.data.name}.data", - # type_=List[List[Any]], - # state=self.data.state, - # ) - # if types.is_dataframe(type(self.data)): - # # If given a pandas df break up the data and columns - # data = serialize(self.data) - # assert isinstance(data, dict), "Serialized dataframe should be a dict." - # self.columns = Var.create_safe(data["columns"]) - # self.data = Var.create_safe(data["data"]) + def _get_app_wrap_components(self) -> dict[tuple[int, str], Component]: + """Get the app wrap components for the component. - # # Render the table. - # return super()._render() + Returns: + The app wrap components. + """ + from reflex.el.elements import Div + + class Portal(Div): + def get_ref(self): + return None + + return {(-1, "DataEditorPortal"): Portal.create(id="portal")} # try: