What is the Javascript() function?

Hi, I’ve come across references to a Javascript( ) function in some Panel sample code. For example, topic 1747

  • Can I use it to execute JS code from my python code?
  • Where is the documentation for it?
  • What library do I need to import?

How does one discover these functions to use anyway? I am new to Panel and have been struggling to find clear documentation on some of the functions. Any help would be appreciated.


I’m not familiar with that function.

However, you can use a jscallback Links — Panel v0.13.1. To trigger the execution from python you could assign this callback to a hidden value of some sort that you increment from python. Surely there is a more elegant way to accomplish it tho.

Hi @andyGxd

Could you write a little bit about what you are trying to achieve? That would make it easier to provide some guidance.

Hi @Marc @CmpCtrl,

Thanks for responding. This question stems from searching for a solution to this Tabulator topic 4174.

I have the following code working from a button and would like to implement a similar call from a Tabulator on_click() function, basically to get the effect of clicking on a link in a Tabulator cell.

btn.js_on_click(code="""window.open("./app2", "_self")""")

Trying to have the Tabulator on_click() do the following action:

def onGridClickPort(event):
    if (event["column"]=="Name") and (event["value"]=="Apple"):
        # Javascript("""window.open("./app2", "_self")""")


1 Like

Ok. The solution appears to be as described in Tabulator on_click() to load a new page - #4 by CongTang