Falko Schindler преди 1 година
родител
ревизия
785d32472d
променени са 2 файла, в които са добавени 4 реда и са изтрити 3 реда
  1. 1 1
      nicegui/elements/aggrid.py
  2. 3 2
      tests/test_aggrid.py

+ 1 - 1
nicegui/elements/aggrid.py

@@ -143,7 +143,7 @@ class AgGrid(Element, component='aggrid.js', libraries=['lib/aggrid/ag-grid-comm
         If the function is awaited, the result of the method call is returned.
         Otherwise, the method is executed without waiting for a response.
 
-        :param row_id: id of the row
+        :param row_id: id of the row (as defined by the ``getRowId`` option)
         :param name: name of the method
         :param args: arguments to pass to the method
         :param timeout: timeout in seconds (default: 1 second)

+ 3 - 2
tests/test_aggrid.py

@@ -217,9 +217,10 @@ def test_problematic_datatypes(screen: Screen):
 def test_run_row_method(screen: Screen):
     grid = ui.aggrid({
         'columnDefs': [{'field': 'name'}, {'field': 'age'}],
-        'rowData': [{'id': 'alice', 'name': 'Alice', 'age': 18}],
+        'rowData': [{'name': 'Alice', 'age': 18}],
+        ':getRowId': '(params) => params.data.name',
     })
-    ui.button('Update', on_click=lambda: grid.run_row_method('alice', 'setDataValue', 'age', 42))
+    ui.button('Update', on_click=lambda: grid.run_row_method('Alice', 'setDataValue', 'age', 42))
 
     screen.open('/')
     screen.should_contain('Alice')