Update: version 1.16 has been released since this was posted.
Dash 1.2.0 is a minor release with features and bug fixes for dash, dash-core-components and dash-table.
Changelog
Highlights
- Selectable table columns
- Improved (simplified) devtools tracebacks PR
- Minor update from Plotly.js 1.49.1 to 1.49.4
Bug Fixes
- Table export and header renaming bug fixes
- dcc.Graph, dcc.DatePickerRange #1 and dcc.DatePickerRange #2 bug fixes
Previous Releases
Code Examples
Select table columns and modify the selected columns style:
import dash
from dash_table import DataTable, FormatTemplate
app = dash.Dash(__name__)
app.layout = DataTable(
id='table',
columns=[{
'name': x,
'id': x,
'selectable': True
} for x in ['a', 'b', 'c', 'd']],
column_selectable="single",
data=[{
'a': 'a' + str(x),
'b': 'b' + str(x) + str(x),
'c': 'c' + str(x) + 'c',
'd': 'd' + str(x) + '-' + str(x)
} for x in range(0,100)]
)
@app.callback(
Output('table', 'style_data_conditional'),
[Input('table', 'selected_columns')]
)
def update_styles(selected_columns):
return [{
'if': { 'column_id': i },
'background_color': '#D2F3FF'
} for i in selected_columns]
if __name__ == '__main__':
app.run_server(debug=True)
For use in callbacks, the props selected_columns
and derived_viewport_selected_columns
respectively contain the list of all selected columns and the list of all non-hidden selected columns.