I have created a dash application in which you need to add a tab with a table. there is no problem in this. the problem is that I can create a table with data like: int, str, bool. however, I have a column with a link for which I need to create an additional column with a button to download (upload) a log file from this link. here is my code:
however, when loading the application, an error of incorrect data format is displayed and the application does not work. please tell me what options there are. thanks
First off, you are trying to render a dash component with markdown, this is not how it works, I donât think. It should either be markdown or raw html.
With that being said, you just need to change your function to be making a raw html string or markdown text.
Or, you could try taking a look at AG Grid.
This has a markdown section:
Or you could create your own component with just the link in the data and then it just renders the component as a link.
Anyways, there is a lot of flexibility with whatever you decide.
Iâm new to this and it will be difficult to do it without an example. can you give an example of how to create a raw html string or markdown text? I would be very grateful for your help
if i am trying to paste in dash_table dcc.markdown, i receive error: Invalid argument data[0].Column 1 passed into DataTable.
Expected one of type [string, number, boolean].
How to decide it?
I decided it in this way: @callback(
Output(âmodal_contentâ, âchildrenâ),
Input(âdatatable-interactâ, âactive_cellâ),
State(âdatatable-interactâ, âdataâ)
)
def display_log_file_contents(active_cell, data):
if active_cell:
row = active_cell[ârowâ]
column = active_cell[âcolumn_idâ]
if column == âLogfileâ:
log_file = data[row][column]
with open(log_file, ârâ, encoding=âutf-8â) as f:
log_contents = f.read()
return html.Div([
html.P(log_file),
html.Hr(),
html.Br(),
html.Pre(log_contents)
])
else:
return ââ
return ââ
but if I have a table with pagination, it has several pages, when you click on a file located on the second page, a file located on the same line only on the first page is loaded. is there any way to solve this?