Hi @paeger and welcome to the Dash community ![]()
Thanks for the good minimal example and clear description of the issue! This is an odd one.
I ran this example and got an error in the console: “setData is not a function”, and indeed the prop object that gets passed to the component does not include this function. (The setData function is in the props object for the working example in the docs.) I’m not sure why that’s the case, and this might be a question for @jinnyzor
As a workaround, you can trigger the callback by updating a dcc.Store using setProps:
Change the function to
dagcomponentfuncs.ImgThumbnail = function (props) {
function onClick() {
dash_clientside.set_props("store-value", {data: props.value})
}
// rest of function
Then change the callback to:
@callback(
Output("custom-component-img-modal", "is_open"),
Output("custom-component-img-modal", "children"),
Input("store-value", "data"),
)
def show_change(data):
if data:
return True, html.Img(src=data)
return False, None
