fix portal when using multiple datatable (#2094)

This commit is contained in:
Thomas Brandého 2023-11-01 01:07:28 +01:00 committed by GitHub
parent 60c8c1d40e
commit 853a43eaab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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: