Reputation: 1131
i want to link a local HTML file to a plotly dash table.
from dash import Dash
from dash_table import DataTable
import pandas as pd
df = pd.DataFrame(
{
"Links": [
"<a href='https://www.yahoo.com/' target='_blank'>test</a>",
"<a href='../folder/file.html' target='_blank'>local html File</a>",
]
}
)
app = Dash(__name__)
app.layout = DataTable(
id="table",
data=df.to_dict("records"),
columns=[
{"id": "Links", "name": "Job", "presentation": "markdown"},
],
markdown_options={"html": True},
)
if __name__ == "__main__":
app.run_server()
I expect to open a local HTML file with a link out of the datatable
Upvotes: 2
Views: 5141
Reputation: 1131
ok, a solution is to have a "assets" folder in the same directory a the file which deploys the app! the file (html, png ...) is callable with:
"<a href='/assets/test_dir/test1.html' target='_blank'>local html File</a>",
Upvotes: 2
Reputation: 120
import dash_html_components as html
html.A("Link to external site", href='link', target="_blank")
Add this line to your app layout part to open a new window with a hyperlink to another website.
Upvotes: 3