Created
April 21, 2024 16:53
-
-
Save hansthen/4ede0a1fc57c732cd89c9d3dd8f8efad to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import streamlit as st | |
>>from st_aggrid import AgGrid, JsCode, GridOptionsBuilder | |
>>import pandas as pd | |
>>df = pd.read_csv('https://raw.githubusercontent.com/fivethirtyeight/data/master/airline-safety/airline-safety.csv') | |
gb = GridOptionsBuilder.from_dataframe(df) | |
gb.configure_selection('single', pre_selected_rows=[], use_checkbox=False) | |
gridOptions = gb.build() | |
gridOptions['rowClassRules'] = { | |
"row-fail": JsCode(""" | |
function(params) { | |
return params.data.incidents_85_99 > 20; | |
} | |
""") | |
} | |
custom_css = { | |
".row-fail": { | |
"background-color": "orange !important", | |
}, | |
"div.row-fail > div.ag-cell": { | |
"text-decoration": "line-through !important", | |
}, | |
".ag-row-selected": { | |
"background-color": "blue", | |
}, | |
>># "ag-ltr .ag-cell-focus:not(.ag-cell-range-selected):focus-within": { | |
>># "border": "1px solid orange", | |
>># }, | |
".ag-cell-focus:focus-within": { | |
"border": "none !important", | |
}, | |
":root": { | |
"--ag-selected-row-background-color": "blue" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment