Highlight dataTable cell(s) based on surface hoverdata

I’ve got a surface plot and a dataTable next to it and I want to generate a highlighted region on the dataTable based on what I am hovering over on the surface, so based on this hover I should be highlighting the following cell:

I am attempting to do this via a callback with Input as surfaceGraph=hoverdata, Output as table=selected_cells.

My output is currently formatted as:
selectedCellsList = [{‘row’:str(tenorLocation), ‘column’:str(strikeLocation)}]

…I can get everything from the hoverdata and match it to a point on the surface (to give me integers for row and column), but I receive the following error:
dash.exceptions.InvalidCallbackReturnValue: Invalid number of output values for …volGrid.selected_cells…
Expected 1 got 2

I have tried to convert this to a string, but then i receive the error:
Expected the output type to be a list or tuple but got…str(selectedCellsList)

I’m a bit stumped. On the initialisation of another table I can get an area to be selected with the following option:
selected_cells=[{‘row’: ‘5’, ‘column’: ‘2’}]

So I think I have everything in the correct format…

Any suggestions/resolutions would be greatly appreciated.

small update and i’m even more confused as this looks exactly like the data i was passing in my original post, but its not throwing an error when i have the following definition of selectedCellsList:
selectedCellsList = [{‘row’:‘5’, ‘column’:‘5’}]

but equally…it still isn’t displaying anything on the Table

maybe I just misunderstand the selected_cells property and its not able to be an Output, only an Input?

can you share a simple, reproducible example?

the error message sounds like it might just be an issue with the number of arguments you are returning and that not matching up with the Output declaration in that callback

Hi Chris, thanks for replying and forcing me to try to recreate the issue outside of my spaghetti code. On your advice I built a couple of simple examples thinking I would expose a weird bug somewhere but unfortunately/fortunately the issue was between the chair and the desk! As most of them are…

Everything now working as I planned, just needed a careful re-write of the original callback.

As always, thanks very much for the excellent work.