Hi,
May I ask if there is a way to mix bokeh server code and custom JS in a single call back?
For example, I have a button for download, but I want to generate the download file on demand. Something like
def download_func():
# some server side code.
# prepare the target file
# JS code, redirecting the browser to download the file after the preparation is done.
button = Button()
button.on_click(download_func)
``
Something like the readfile() function in PHP that sends a file to user’s browser?
Thanks,
Hongyi
xhongyi
2
I have found another ugly workaround.
Basically, I created an invisible html asset and attached a CustomJS callback to it.
To trigger this CustomJS function, I simply need to update its value in my python code. Wish there were better ways but I guess this works.
···
On Tuesday, December 4, 2018 at 12:57:05 AM UTC-5, Hongyi Xin wrote:
Hi,
May I ask if there is a way to mix bokeh server code and custom JS in a single call back?
For example, I have a button for download, but I want to generate the download file on demand. Something like
def download_func():
# some server side code.
# prepare the target file
# JS code, redirecting the browser to download the file after the preparation is done.
button = Button()
button.on_click(download_func)
``
Something like the readfile() function in PHP that sends a file to user’s browser?
Thanks,
Hongyi
I also do it this way and couldn’t find a better way.
···
On Dec 6, 2018, at 11:57 AM, Hongyi Xin [email protected] wrote:
I have found another ugly workaround.
Basically, I created an invisible html asset and attached a CustomJS callback to it.
To trigger this CustomJS function, I simply need to update its value in my python code. Wish there were better ways but I guess this works.
On Tuesday, December 4, 2018 at 12:57:05 AM UTC-5, Hongyi Xin wrote:
Hi,
May I ask if there is a way to mix bokeh server code and custom JS in a single call back?
For example, I have a button for download, but I want to generate the download file on demand. Something like
def download_func():
# some server side code.
# prepare the target file
# JS code, redirecting the browser to download the file after the preparation is done.
button = Button()
button.on_click(download_func)
``
Something like the readfile() function in PHP that sends a file to user’s browser?
Thanks,
Hongyi
–
You received this message because you are subscribed to the Google Groups “Bokeh Discussion - Public” group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/bokeh/7c0b34f0-0dcf-46b5-89ab-58d4bf6e6f59%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.