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

#1058 add demo for ui.aggrid with HTML columns

Falko Schindler преди 1 година
родител
ревизия
059b04a08e
променени са 1 файла, в които са добавени 15 реда и са изтрити 0 реда
  1. 15 0
      website/more_documentation/aggrid_documentation.py

+ 15 - 0
website/more_documentation/aggrid_documentation.py

@@ -138,3 +138,18 @@ def more() -> None:
 
         df = pd.DataFrame(data={'col1': [1, 2], 'col2': [3, 4]})
         ui.aggrid.from_pandas(df).classes('max-h-40')
+
+    @text_demo('Render columns as HTML', '''
+        You can render columns as HTML by passing a list of column indices to the `html_columns` argument.
+    ''')
+    def aggrid_with_html_columns():
+        ui.aggrid({
+            'columnDefs': [
+                {'headerName': 'Name', 'field': 'name'},
+                {'headerName': 'URL', 'field': 'url'},
+            ],
+            'rowData': [
+                {'name': 'Google', 'url': '<a href="https://google.com">https://google.com</a>'},
+                {'name': 'Facebook', 'url': '<a href="https://facebook.com">https://facebook.com</a>'},
+            ],
+        }, html_columns=[1])