Skip to content

Clickable icon in AG Grid #3166

Closed Answered by afullerx
HertZz98 asked this question in Q&A
Jun 3, 2024 · 1 comments · 2 replies
Discussion options

You must be logged in to vote

Hi @HertZz98, I'm not personally experienced with AG Grid, but I see there is an option to render columns as HTML. Something like this seems to work:

def on_cell_clicked(args):
    if 'class="icon-cell"' in args['value']:
        ui.notify(f'Icon clicked: {args["data"]["icon_id"]}')

icon_url = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAH3AAAB9wEeuin8AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAIBJREFUOI3t0cEJhDAQheF/FltYrGK92IkVbBXbkkW4dpBGBPHm+e0lARkDGz2KAw+GZPIREiQhCSAAcvkAHdCkOZ8H/+sJfM2syW2WAFvkdRZIyOiRI0AWqQoO9cDg1tbUWPwBzCwArRucgDmDBknvkhvUMb6W1Bx9g13dwCWAHyDTLz9JoiqhAAAAAElFTkSuQmCC'
icon_html = f'<img class="icon-cell" src="{icon_url}">'

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@afullerx
Comment options

@HertZz98
Comment options

Answer selected by HertZz98
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants