Thanks to your help before, I can extract the column name of a glyph that has been tapped like so:
def get_customjs(source): # simple example callback = CustomJS(args=dict(source = source), code = """ var index = source.selected.indices var iso = source.data["ISOA2_code"][index] console.log(iso) # prints out the ISO code of the country """) return callback taptool = TapTool(callback = get_customjs(geosource))
From my understanding CustomJS is designed to be changing current column data sources,using emit change and trigger change. However, the data I need to be filtered by the ISO code is not the source I’m passing to the callback, it’s a separate, bigger data frame I have stored in my script… So ideally I need a way to directly pass this iso variable to my Python code, so I can later use it to further process my data.
I have tried converting my other data frame to a column data source, pass that also to the JS callback and use the CDS View to filter within the JS callback, but the fact remains all the filtering and processing I want to do with it later is in the Python code, so I’d need to pass the CDS View then to Python. Ideally I am looking to pass the iso variable though (from the snippet above).
Just curious if there was a way to do that, if not I’ll try to restructure my code to make it possible