Skip to content

Instantly share code, notes, and snippets.

@mebaysan
Last active November 17, 2020 11:59
Show Gist options
  • Save mebaysan/a6cfec05183eacff9e020040fa19ca88 to your computer and use it in GitHub Desktop.
Save mebaysan/a6cfec05183eacff9e020040fa19ca88 to your computer and use it in GitHub Desktop.
Plotly Dash Bootstrap Component Tablo Oluşturmak için Snippet

Tablomuzu oluşturacak fonksiyon

import dash_html_components as html
import dash_bootstrap_components as dbc


def get_basic_table(headers, rows, style):
    table_header = [
        html.Thead(html.Tr([html.Th(f"{header}") for header in headers]))
    ]
    table_rows = []
    for row in rows:
        table_rows.append(html.Tr([html.Td(f"{row}"), html.Td(f"{rows[row]}")]))
    table_body = [html.Tbody(table_rows)]
    table = dbc.Table(table_header + table_body,
                      bordered=True,
                      hover=True,
                      responsive=True,
                      striped=True, style=style)
    return table

Örnek bir kullanım

style = {'fontSize': '15px'}

headers = ['Kolon1', 'Kolon2']

rows = {
'Kolon1 Satır1': 'Kolon2 Satır1',
'Kolon1 Satır2':'Kolon2 Satır2',
}

table = get_basic_table(headers=headers, rows=rows, style=style)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment