-
Notifications
You must be signed in to change notification settings - Fork 17
Closed
Milestone
Description
For some methods, such as ui.table.context_menu, we want to provide menu action items from a callable. Meaning we need a way to notify the client of these callables, and then have the client call back when they're out of scope so they are cleaned up properly.
e.g. With a context menu call:
def _on_context_menu(cell_index: CellIndex, row_data: RowData) -> ContextMenuAction:
# This method `print_hello_world` is getting returned to the client as a result of the call to get menu items when the context menu is triggered on the client
def print_hello_world():
print("Hello World")
return ContextMenuAction(title="Hello World", action=print_hello_world)
# The method `_on_context_menu` gets called when the context menu is triggered on the client
ui_table.context_menu(items=_on_context_menu)So it should work for the context_menu, but be done in a generic way such that any callable that returns other objects/callables as part of the result, should retain those objects/callables until the client has instructed they can be deleted/cleaned up.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels