📣 Dash 1.2.0 released

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

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.

4 Likes