@chriddyp
If you see here, the datatable header overlaps on dropdown list. It is happening for other apps too. is this a bug?
I donāt work here, just follow the whatās going on. If you post a small code example to here or the github you might get a better response.
FYI, Iāve had a lot of trouble laying out the DataTable with the common CSS patterns provided, but not sure if thatās my fault as Iām not very experienced with CSS.
Oh I didnāt know that. Sorry @Damian.
@app.callback(Output(ātab_dataā, āchildrenā),
[Input(āconfig_listā, āvalueā),
Input(āsheet_namesā, āvalueā)]
)
def display_tab_data(config, tab):
if tab:
tab_df = pd.read_excel(āC:\Users\N0207022\Desktop\NGRT\Config\HMR\{}.xlsxā.format(config), sheet_name=tab)
table_data = dash_table.DataTable(
id='table',
columns=[{"name": i, "id": i} for i in tab_df.columns],
data=tab_df.to_dict("rows"),
n_fixed_rows=1,
style_table={'overflowX': 'scroll',
'maxHeight': '700px',
'maxWidth': '1500px',
'border': 'thin lightgrey solid'
},
style_cell={'width': '150px',
'textAlign': 'left'
},
style_cell_conditional=[
{
'if': {'row_index': 'odd'},
'backgroundColor': 'rgb(248, 248, 248)'
}
],
style_header={
'backgroundColor': '#3DC2ED',
'fontWeight': 'bold'
},
css=[{
'selector': '.dash-cell div.dash-cell-value',
'rule': 'display: inline; white-space: inherit; overflow: inherit; text-overflow: inherit;'
}],
)
return table_data
Same problem. I havenāt dug into the DataTable code yet, but I suspect this is a common problem, since data is often displayed beneath a drop-down. Maybe a CSS issue?
Thanks for reporting this. Weāve opened an issue for it here to follow it up: https://github.com/plotly/dash-table/issues/303.
This happens because with fixed rows the header must be absolutely positioned and is given a z-index to behave visually correctly in respect to other absolutely positioned items in the table.
Hi!
I donāt know what made it work, but I used this this css to stylize the table and edited the three columns
class so that it looks like this:
.three.columns { width: 22%;
z-index: 1111;
margin-bottom: 20px }
Then, when declaring the dropdown I assigned it as a className;
dcc.Dropdown(id='my-dropdown',
#[...]
className='three columns',
#[...]
After that, when declaring the dashtable I assigned this style_header to it:
dash_table.DataTable(
id='table',
#[...]
style_header={
#[...]
'z-index': '5px'
},
#[...]
And it worked perfectly! I havenāt found yet what makes it work, but Iām satisfied with the results
This will be fixed in the next Dash release.
Set the dcc.DateRangePicker(ā¦, style={āpositionā: ārelativeā, āzIndexā: 999}) works for me~ because the zIndex determine the z-index property specifies the stack order of an element.
An element with greater stack order is always in front of an element with a lower stack order. (From w3schools)