tables module¶
- class EditingTable(label, inputs, states, get_data_func, log_filepath=None, update_table_func=None, output=None, output_varselector_name=None, number_format=None, justify_edit=True, **kwargs)¶
Bases:
objectA reusable and flexible Dash component for editing tabular data.
This component renders a Dash AgGrid table where each edit can be optionally confirmed with a user-provided reason before being persisted.
- Workflow when justify_edit=True:
Data is loaded into AgGrid via get_data_func.
When a cell is edited, a modal opens requesting a reason.
- If confirmed:
The edit is logged (with reason and timestamp).
The update_table_func is optionally invoked.
The in-memory table data is updated.
- If cancelled:
The modal closes and the table reverts to its last saved state.
- Workflow when justify_edit=False:
Edits are accepted immediately, logged without reason supplied, and persisted.
- Parameters:
label (str)
inputs (list[str])
states (list[str])
get_data_func (Callable[[...], Any])
log_filepath (str | None)
update_table_func (Callable[[...], Any] | None)
output (str | list[str] | None)
output_varselector_name (str | list[str] | None)
number_format (str | None)
justify_edit (bool)
kwargs (Any)
- layout()¶
Returns the layout for the EditingTable module.
Because this module can be used as a a component in other modules, it needs to have a layout method that is not abstract. For implementations as tab or window, this method should still be overridden.
- Returns:
A Dash HTML Div component representing the layout of the module to be displayed directly.
- Return type:
html.Div
- module_callbacks()¶
Register Dash callbacks for the component.
Defines callback chains for: - Loading data into AgGrid (load_to_table). - Capturing edits and opening the modal (capture_edit). - Confirming edits (logging + updating table data) (confirm_edit). - Cancelling edits (reverting table to saved state) (cancel_edit).
- Return type:
None
- class EditingTableTab(label, inputs, states, get_data_func, log_filepath=None, update_table_func=None, output=None, output_varselector_name=None, number_format=None, justify_edit=True, **kwargs)¶
Bases:
TabImplementation,EditingTableEditingTable embedded in a tab container.
- Parameters:
label (str)
inputs (list[str])
states (list[str])
get_data_func (Callable[[...], Any])
log_filepath (str | None)
update_table_func (Callable[[...], Any] | None)
output (str | None)
output_varselector_name (str | None)
number_format (str | None)
justify_edit (bool)
kwargs (Any)
- class EditingTableWindow(label, inputs, states, get_data_func, log_filepath=None, update_table_func=None, output=None, output_varselector_name=None, number_format=None, justify_edit=True, **kwargs)¶
Bases:
WindowImplementation,EditingTableA class to implement an EditingTable module inside a modal.
- Parameters:
label (str)
inputs (list[str])
states (list[str])
get_data_func (Callable[[...], Any])
log_filepath (str | None)
update_table_func (Callable[[...], Any] | None)
output (str | None)
output_varselector_name (str | None)
number_format (str | None)
justify_edit (bool)
kwargs (Any)