[Aggrid] Displaying cell information when the mouse is over a cell on an Aggrid table

Hi @AlexWeeM,

Try this code if you have not yet found a solution:

import streamlit as st
from st_aggrid import JsCode, AgGrid, GridOptionsBuilder
from st_aggrid.shared import GridUpdateMode

df=pd.DataFrame({ "Name": ['Erica', 'Rogers', 'Malcolm', 'Barrett'], "Age": [43, 35, 57, 29]})

tooltipjs = JsCode(""" function(params) { return '<span title="' + params.value + '">'+params.value+'</span>';  }; """) # if using with cellRenderer

gridOptions = GridOptionsBuilder.from_dataframe(df)
gridOptions.configure_column('Name', editable=False, cellRenderer=tooltipjs)
gridOptions.configure_default_column(editable=True)
gb = gridOptions.build()

dta = AgGrid(df, gridOptions=gb, height=350, allow_unsafe_jscode=True, theme="blue", update_mode=GridUpdateMode.SELECTION_CHANGED)

Cheers

2 Likes