Reputation: 25
Is it possible to insert - for example - a pn.widgets.Button()
widget into a HTML table cell in a pn.pane.HTML()
panel?
Something like:
import panel as pn
def button_callback(event):
pn.pane.Alert("Button clicked!", alert_type="success").show()
button = pn.widgets.Button(name='Click me!')
button.on_click(button_callback)
table_html = f"""
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Cell 1</td>
<td>{button}</td>
</tr>
</table>
"""
html_pane = pn.pane.HTML(table_html)
html_pane.show()
Unfortunately, in the example above, the button is not represented correctly:
Upvotes: -1
Views: 143
Reputation: 25
As a workaround you can use GridBox and iterate through the table and add the button at the desired place.
Thanks!
Upvotes: 0