diff --git a/nicegui/elements/table.py b/nicegui/elements/table.py index b8991c796..78e062ef0 100644 --- a/nicegui/elements/table.py +++ b/nicegui/elements/table.py @@ -13,6 +13,8 @@ def __init__(self, options: Dict, *, html_columns: List[int] = [], theme: str = An element to create a table using `AG Grid `_. + The `call_api_method` method can be used to call an AG Grid API method. + :param options: dictionary of AG Grid options :param html_columns: list of columns that should be rendered as HTML (default: `[]`) :param theme: AG Grid theme (default: 'balham') @@ -31,4 +33,11 @@ def update(self) -> None: self.run_method('update_grid') def call_api_method(self, name: str, *args) -> None: + """Call an AG Grid API method. + + See `AG Grid API `_ for a list of methods. + + :param name: name of the method + :param args: arguments to pass to the method + """ self.run_method('call_api_method', name, *args) diff --git a/website/reference.py b/website/reference.py index b96518690..14430727f 100644 --- a/website/reference.py +++ b/website/reference.py @@ -259,6 +259,7 @@ def table_example(): {'name': 'Bob', 'age': 21}, {'name': 'Carol', 'age': 42}, ], + 'rowSelection': 'multiple', }).classes('max-h-40') def update(): @@ -266,6 +267,7 @@ def update(): table.update() ui.button('Update', on_click=update) + ui.button('Select all', on_click=lambda: table.call_api_method('selectAll')) @example(ui.chart, menu) def chart_example():