Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

How to resize Dash datatable

$
0
0

I am working with the Dash datatable. I am trying to resize my table so it does not take the whole browser width like it is shown currently below: I would like some padding around it.

Here is my current working code:

output = dash_table.DataTable(id='table_overview', 

                                      

                                      columns=[{'name': col, 

                                                'id': col} 

                                               for col in df.columns],

                                      

                                      style_table= {'overflowX': 'auto', 'height': '300px', 'overflowY': 'auto'},

                                      

                                      style_data = {"text-align": "center"},

                                      

                                      style_header={

                                          'backgroundColor': 'rgb(6, 67, 122)',

                                          'color': 'white',

                                          "text-align": "center",

                                          'fontWeight': 'bold'},

                                      

                                      style_cell={

                                          # all three widths are needed

                                          'minWidth': '180px', 

                                          'width': '180px', 

                                          'maxWidth': '180px',

                                          'overflow': 'hidden',

                                          'textOverflow': 'ellipsis',

                                        },

                                      

                                      data=df.to_dict('records'),

                                      

                                      page_size=20,

                                                                  

                                      )

Additionally, in the sample on Dash datatable, the controls at the bottom seem to be working without a callback. Is a callback necessary for this as well? Your help is greatly appreciated

10 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles