Bring Drag & Drop to Dash with Dashboard Engine. 💫 Learn how at our next webinar!

Issues with dash data table

Hi everyone, I’m Thiago, is a pleasure to be here. let’s go to the problem.

I’m stucked in a problem using dash data table, why he is not formatting the items and putting the symbol that is the prefix in the cells, I’m reading the data from a csv file, which unfortunately I can’t share here, but, I’ll put the code below so that someone can see if I’m doing it something wrong maybe.

the table: Screenshot_1

and the code: `

columns = [
‘dtEmissao’,
‘tipoDoc’,
‘codigo’,
‘denominacao’,
‘qtDoc’,
‘totNota’,
‘icmsDestac’,
]

    dash_table.DataTable(
    columns=[
        {"name": "Data emissão", "id": columns[0]},
        {"name": "Tipo do Documento", "id": columns[1]},
        {"name": "Código", "id": columns[2]},
        {"name": "Denominação", "id": columns[3]},
        {"name": "Quantidade Documentos", "id": columns[4]},
        {"name": "Total nota", "id": columns[5], "type": "numeric", "format": Format(
            scheme=Scheme.fixed,
            precision=2,
            group=Group.yes,
            groups=3,
            group_delimiter='.',
            decimal_delimiter=',',
            symbol=Symbol.yes,
            symbol_prefix=u'R$')},
        {"name": "ICMS", "id": columns[6], "type": "numeric", "format": Format(
            scheme=Scheme.fixed,
            precision=2,
            group=Group.yes,
            groups=3,
            group_delimiter='.',
            decimal_delimiter=',',
            symbol=Symbol.yes,
            symbol_prefix=u'R$'
        )}
    ],
    data=df.to_dict('records'),
    style_cell={
        'text-align': 'center',
        'minWidth': 95,
        'Width': 100,
        'font-family': 'roboto, sans-serif',
        'font-size': '14px'
    },
    page_size=50
)`

the imports from dash_table.Format import Format, Symbol, Group, Scheme

Hi @Thiago18l and welcome to the Dash community!

Your code looks correct. Is it only the symbol that is not formatting? If so make sure to include this is in the first line of the .py file:

# -*- coding: utf-8 -*-

Another thing to try is just a string

symbol_prefix="R$ "
1 Like