I am brand new to Dash and have been using it for a couple of days. I couldn’t find what I needed on the internet, and the documentation is still not fleshed out as Dash is still pretty new.
I hope the community can help me!
In order to learn the ropes, I am building a small dashboard that generates some code for me, but I am loosing my indentations. It looks like html.Td() is stripping away all white spaces.
Here is my input: two lists containing an input and output variable.
After submitting, I generate the code and store it in a dataframe.
I am using the variable ‘Indent’ as a flag variable. I am trying to add 4 white spaces to make the indentation:
return html.Table( [html.Tr( [html.Td(' ' + df.iloc[i]['Codeline'])] if df.iloc[i]['Indent'] == 1 else [html.Td(df.iloc[i]['Codeline'])] ) for i in range(len(df))] )
But here is the result:
I tried adding the white spaces directly in the dataframe, but they disappeared when I displayed them in the dashboard. That’s why I tried adding it when generating the table rows with html.Td(), but they still go away. I also tried using the HTML whitespace character
but it was a complete disaster.
I don’t know how to fix this. Does anyone have any tips?