Преглед на файлове

allow clearing a group containing an AgGrid

Falko Schindler преди 3 години
родител
ревизия
d63c086402
променени са 1 файла, в които са добавени 2 реда и са изтрити 1 реда
  1. 2 1
      nicegui/elements/group.py

+ 2 - 1
nicegui/elements/group.py

@@ -23,7 +23,8 @@ class Group(Element):
 
     def clear(self):
         def collect_components(view: jp.HTMLBaseComponent) -> List[jp.HTMLBaseComponent]:
-            return view.components + [view for child in view.components for view in collect_components(child)]
+            children = getattr(view, 'components', [])
+            return children + [view for child in children for view in collect_components(child)]
         components = collect_components(self.view)
 
         active_links[:] = [