|
@@ -40,7 +40,7 @@ class AgGrid(Element, component='aggrid.js', libraries=['lib/aggrid/ag-grid-comm
|
|
self._classes = ['nicegui-aggrid', f'ag-theme-{theme}']
|
|
self._classes = ['nicegui-aggrid', f'ag-theme-{theme}']
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
- def from_pandas(df: pd.DataFrame, *, theme: str = 'balham') -> AgGrid:
|
|
|
|
|
|
+ def from_pandas(df: pd.DataFrame, *, theme: str = 'balham', auto_size_columns: bool = True) -> AgGrid:
|
|
"""Create an AG Grid from a Pandas DataFrame.
|
|
"""Create an AG Grid from a Pandas DataFrame.
|
|
|
|
|
|
:param df: Pandas DataFrame
|
|
:param df: Pandas DataFrame
|
|
@@ -52,7 +52,7 @@ class AgGrid(Element, component='aggrid.js', libraries=['lib/aggrid/ag-grid-comm
|
|
return AgGrid({
|
|
return AgGrid({
|
|
'columnDefs': [{'field': col} for col in df.columns],
|
|
'columnDefs': [{'field': col} for col in df.columns],
|
|
'rowData': df.to_dict('records'),
|
|
'rowData': df.to_dict('records'),
|
|
- }, theme=theme)
|
|
|
|
|
|
+ }, theme=theme, auto_size_columns=auto_size_columns)
|
|
|
|
|
|
@property
|
|
@property
|
|
def options(self) -> Dict:
|
|
def options(self) -> Dict:
|