Datatable FormatTemplate not working with 'presentation': 'markdown' in Python

Hi there!

I’m currently trying to format some datatable content to show percentages on a table that also needs markdown for links. It’s not displaying the percentages when the type is markdown but it does when I comment it out. Here is my code:

        columns = [
            {
                "name": i,
                "id": i,
                "type": "text",
                "presentation": "markdown"
            }
            for i in sensor_info.columns
        ]
        columns[-2]["type"]="numeric"
        columns[-2]["format"]=FormatTemplate.percentage(1)

Which produces the below:

And when I comment out the line about markdown:

        columns = [
            {
                "name": i,
                "id": i,
                "type": "text",
                # "presentation": "markdown"
            }
            for i in sensor_info.columns
        ]
        columns[-2]["type"]="numeric"
        columns[-2]["format"]=FormatTemplate.percentage(1)

This is what we get

Is there something I should also be doing here?

I’m using Python 3.8.5, latest version of dash_table (I pip installed yesterday) and I’m running on Chrome (Version 87.0.4280.141 (Official Build) (x86_64)) on a MacBook Pro 2015.

Let me know if there’s anything else that you need!

All the best,
Ash

Just a quick note - I am working around it by converting my pandas dataframe column to a formatted string, so I’m not out of options, I just thought I’d mention it as it doesn’t seem to be expected behaviour and thought Plotly might want to know :slight_smile:

Hi @noodle_loaf wellcome to Dash Community.

See if this link can help:

1 Like