I’m creating a screen for project management. For that, I’m trying to use the tooltip component of aggrid. In this case, there would be a table with the tasks and I would like that when I hover over a certain one, it will show a pop-up with some information about that task.
I tried to do what has been described here, I tried to make some adaptations but nothing worked
My code so far has been this, but so far nothing has worked, when I hover over one of the columns it only shows the name of that cell.
O código base que eu estou tentando está conforme abaixo:
gb = ag.GridOptionsBuilder.from_dataframe(df)
gridOptions = gb.build()
customTooltip = ag.JsCode(“”"class CustomTooltip {
init(params) {
this.eGui = document.createElement(‘div’);
this.color = ‘white’;
this.data = params.api.getDisplayedRowAtIndex(params.rowIndex).data;
this.eGui.classList.add('custom-tooltip');
//@ts-ignore
this.eGui.style['background-color'] = color;
this.eGui.innerHTML = `
<p>
<span class"id">${this.data.task_id}</span>
</p>
<p>
<span>Name: </span>
${this.data.task_name}
</p>
`;
}
getGui() {
return this.eGui;
}
}""")
gridOptions["tooltipShowDelay"] = 0
gridOptions["tooltipHideDelay"] = 2000
columnsDefs = list(map(lambda x: {"field": x}, columns))
columnsDefs = [({"field": column["field"], "cellRenderer":self.set_checkbox()}) if column["field"] in list(
df.select_dtypes("bool").columns) else ({"field": column["field"], "tooltipField": column["field"]}) for column in columnsDefs]
gridOptions["columnDefs"] = columnsDefs
gridOptions["tooltipComponent"] = customTooltip