Browse Source

#242 add documentation for table.call_api_method

Falko Schindler 2 years ago
parent
commit
9a1f418470
2 changed files with 11 additions and 0 deletions
  1. 9 0
      nicegui/elements/table.py
  2. 2 0
      website/reference.py

+ 9 - 0
nicegui/elements/table.py

@@ -13,6 +13,8 @@ class Table(Element):
 
         An element to create a table using `AG Grid <https://www.ag-grid.com/>`_.
 
+        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 @@ class Table(Element):
         self.run_method('update_grid')
 
     def call_api_method(self, name: str, *args) -> None:
+        """Call an AG Grid API method.
+
+        See `AG Grid API <https://www.ag-grid.com/javascript-data-grid/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)

+ 2 - 0
website/reference.py

@@ -259,6 +259,7 @@ To overlay an SVG, make the `viewBox` exactly the size of the image and provide
                 {'name': 'Bob', 'age': 21},
                 {'name': 'Carol', 'age': 42},
             ],
+            'rowSelection': 'multiple',
         }).classes('max-h-40')
 
         def update():
@@ -266,6 +267,7 @@ To overlay an SVG, make the `viewBox` exactly the size of the image and provide
             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():