-
Notifications
You must be signed in to change notification settings - Fork 0
/
try.py
29 lines (24 loc) · 930 Bytes
/
try.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import streamlit as st
from st_aggrid import AgGrid, GridOptionsBuilder
# Define the data and column definitions
data = [
{"id": 1, "username": "John", "email": "john@example.com"},
{"id": 2, "username": "Alice", "email": "alice@example.com"},
{"id": 3, "username": "Bob", "email": "bob@example.com"},
{"id": 4, "username": "Emily", "email": "emily@example.com"},
]
column_defs = [
{"field": "id", "checkboxSelection": True},
{"field": "username"},
{"field": "email"},
]
# Build the GridOptions
gob = GridOptionsBuilder()
gob.configure_pagination(enabled=True, paginationAutoPageSize=True, paginationPageSize=10)
gob.configure_selection(selection_mode = 'multiple', use_checkbox = False, pre_selected_rows = [])
gob.set_column_defs(column_defs)
gob.set_default_col_def(flex=1)
grid_options = gob.build()
# Create the Ag Grid
with st.expander("Ag Grid"):
AgGrid(data, gridOptions=grid_options)