|
import streamlit as st
|
|
import pandas as pd
|
|
from st_aggrid import AgGrid
|
|
|
|
|
|
|
|
|
|
num=range(1,10)
|
|
data=pd.DataFrame({'A':num,'B':num,'C':num})
|
|
|
|
gridOptions = {
|
|
"columnDefs": [
|
|
{'headerName':'A列',"field": 'A','width':80,'cellStyle':{'color':'red','textAlign': 'center','font-weight':'bold'}},
|
|
|
|
{'headerName':'B列',"field": 'B','width':144,'cellStyle':{'color':'red','textAlign': 'center','font-weight':'bold'}},
|
|
{'headerName':'C列',"field": 'C','width':80,'cellStyle':{'color':'red','textAlign': 'center','font-weight':'bold'}}
|
|
],
|
|
"defaultColDef": {
|
|
"sortable": True,
|
|
"filter": False,
|
|
|
|
},
|
|
}
|
|
|
|
|
|
data_ag = AgGrid(data,
|
|
gridOptions=gridOptions,
|
|
|
|
allow_unsafe_jscode=True,
|
|
key=1,
|
|
custom_css={'.ag-header-cell-text':{'flex':'1','text-align':'center'}})
|
|
|
|
|
|
c1,c2=st.columns(2)
|
|
with c1:
|
|
AgGrid(data,
|
|
gridOptions=gridOptions,
|
|
allow_unsafe_jscode=True,
|
|
key=2,
|
|
custom_css={'.ag-header-cell-text': {'flex': '1', 'text-align': 'center'}})
|
|
|
|
|
|
c1,c2=st.columns(2)
|
|
with c1:
|
|
AgGrid(data,
|
|
gridOptions=gridOptions,
|
|
allow_unsafe_jscode=True,
|
|
fit_columns_on_grid_load=True,
|
|
key=3,
|
|
custom_css={'.ag-header-cell-text': {'flex': '1', 'text-align': 'center'}})
|
|
|
|
|
|
c1,c2,c3=st.columns([1,2,1])
|
|
with c2:
|
|
AgGrid(data,
|
|
gridOptions=gridOptions,
|
|
allow_unsafe_jscode=True,
|
|
fit_columns_on_grid_load=True,
|
|
key=4,
|
|
custom_css={'.ag-header-cell-text': {'flex': '1', 'text-align': 'center'}})
|
|
|
|
|
|
|
|
|
|
|