reuse data_callback name if already set during first call to add_hooks

This commit is contained in:
Lendemor 2024-12-11 23:49:37 +01:00
parent 126a97191d
commit 8c01fdbfdc

View File

@ -360,6 +360,9 @@ class DataEditor(NoSSRComponent):
editor_id = get_unique_variable_name()
# Define the name of the getData callback associated with this component and assign to get_cell_content.
if self.get_cell_content is not None:
data_callback = self.get_cell_content._js_expr
else:
data_callback = f"getData_{editor_id}"
self.get_cell_content = Var(_js_expr=data_callback) # type: ignore