diff --git a/CHANGELOG.md b/CHANGELOG.md index 09d14fdf4..59870ec86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,15 @@ This project adheres to [Semantic Versioning](http://semver.org/). ## [Unreleased] ### Added +[#314](https://github.com/plotly/dash-table/issues/314) +- New `column.hideable` flag that displays an "eye" action icon in the column + Accepts a boolean, array of booleans, 'last' or 'first'. Clicking on the "eye" will add the column to the `hidden_columns` prop. + `hidden_columns` can be added back through the Columns toggle menu whether they are hideable or not. +- New accepted values for `column.clearable`, `column.deletable` and `column.renamable` + These props now also accept 'last' and 'first'. + - 'last' will display the action only on the last row of the headers + - 'first' will display the action only on the first row of the headers + [#313](https://github.com/plotly/dash-table/issues/313) - Ability to export table as csv or xlsx file. diff --git a/dash_table/index.html b/dash_table/index.html index daab9fee6..613c17016 100644 --- a/dash_table/index.html +++ b/dash_table/index.html @@ -5,9 +5,8 @@
- - - + + diff --git a/demo/AppMode.ts b/demo/AppMode.ts index 873b07d70..788823a74 100644 --- a/demo/AppMode.ts +++ b/demo/AppMode.ts @@ -7,15 +7,14 @@ import { PropsWithDefaults, ChangeAction, ChangeFailure, - IVisibleColumn, ColumnType, TableAction } from 'dash-table/components/Table/props'; import { TooltipSyntax } from 'dash-table/tooltips/props'; export enum AppMode { - Clearable = 'clearable', - ClearableMerged = 'clearableMerged', + Actionable = 'actionable', + ActionableMerged = 'actionableMerged', Date = 'date', Default = 'default', Filtering = 'filtering', @@ -178,7 +177,7 @@ function getTypedState() { const state = getDefaultState(); R.forEach(column => { - (column as IVisibleColumn).on_change = { + column.on_change = { action: ChangeAction.Coerce, failure: ChangeFailure.Reject }; @@ -187,19 +186,20 @@ function getTypedState() { return state; } -function getClearableState() { +function getActionableState() { const state = getDefaultState(); state.tableProps.filter_action = TableAction.Native; R.forEach(c => { c.clearable = true; + c.hideable = [false, false, true]; }, state.tableProps.columns || []); return state; } -function getClearableMergedState() { - const state = getClearableState(); +function getActionableMergedState() { + const state = getActionableState(); state.tableProps.merge_duplicate_headers = true; return state; @@ -345,10 +345,10 @@ function getState() { const mode = Environment.searchParams.get('mode'); switch (mode) { - case AppMode.Clearable: - return getClearableState(); - case AppMode.ClearableMerged: - return getClearableMergedState(); + case AppMode.Actionable: + return getActionableState(); + case AppMode.ActionableMerged: + return getActionableMergedState(); case AppMode.Date: return getDateState(); case AppMode.Filtering: diff --git a/demo/index.html b/demo/index.html index b00532b7c..613c17016 100644 --- a/demo/index.html +++ b/demo/index.html @@ -5,10 +5,9 @@ - - - - + + +