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

Hi everyone !

I am using the Aggrid component and I want to display a cell information when the mouse is over it as with a dataframe (see the image below). I have seen here that it’s possible to do things with the cellMouseOver event. However I don’t know how to code in Java so it’s hard for me to implement uncommon stuff for aggrid. Is it possible to do it as with a simple dataframe ?
Thanks for your help !
Alexis

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

Perfect!