Browse Source

code review

Falko Schindler 1 year ago
parent
commit
eeca8b594f
1 changed files with 7 additions and 10 deletions
  1. 7 10
      nicegui/elements/aggrid.py

+ 7 - 10
nicegui/elements/aggrid.py

@@ -80,9 +80,8 @@ class AgGrid(Element):
         rows = await self.get_selected_rows()
         return rows[0] if rows else None
 
-
     async def get_client_data(self) -> List[Dict]:
-        """Gets the data from the client including any edits made by the client.
+        """Get the data from the client including any edits made by the client.
 
         This method is especially useful when the grid is configured with ``'editable': True``.
 
@@ -90,20 +89,18 @@ class AgGrid(Element):
 
         :return: list of row data
         """
-        result = await run_javascript(
-            f"""
-            let rowData = [];
+        result = await run_javascript(f'''
+            const rowData = [];
             getElement({self.id}).gridOptions.api.forEachNode(node => rowData.push(node.data));
             return rowData;
-            """
-        )
+        ''')
         return cast(List[Dict], result)
 
     async def load_client_data(self) -> None:
-        """Obtains client data and updates the element's row data with it.
+        """Obtain client data and update the element's row data with it.
 
         This syncs edits made by the client in editable cells to the server.
         """
         client_row_data = await self.get_client_data()
-        self.options["rowData"] = client_row_data
-        self.update()
+        self.options['rowData'] = client_row_data
+        self.update()