Issue 315: Clearable columns#497
Conversation
| } | ||
|
|
||
| return newMap; | ||
| } |
There was a problem hiding this comment.
Isolating the map update logic - can be called for a single column update (user edits filter) or through header clear and delete column actions (which may impact multiple columns at the same time)
| ).join(' && '); | ||
|
|
||
| setFilter(globalFilter, rawGlobalFilter, map); | ||
| } |
There was a problem hiding this comment.
Same idea here, isolating the state update logic for both scenarios.
| }; | ||
| } | ||
| clearColumnsFilter(map, affectedColumns, setFilter); | ||
| }; |
There was a problem hiding this comment.
Delete and clear apply the same logic, only the action changes
| return typeof flag === 'boolean' ? | ||
| flag : | ||
| !!flag && flag[i]; | ||
| } |
There was a problem hiding this comment.
renamable, clearable, deletable all use the same logic to decide whether the action is available
| }; | ||
|
|
||
| const filterFactory = new FilterFactory(augmentedPropsFn); | ||
| const headerFactory = new HeaderFactory(augmentedPropsFn); |
There was a problem hiding this comment.
headers now need access to map/setFilter too, generalize usage
- update changelog
alexcjohnson
left a comment
There was a problem hiding this comment.
Code looks great. I'd just like to see a percy test including both deletable and clearable to know a) what the Ø looks like in the default font, and b) how the two symbols look next to each other.
|
@alexcjohnson Good idea, adding a few visual tests. Keeping in mind that we have #495 as a follow up. |
|
Thanks for the visual tests! |
|
Action "icons" can now be overridden through css or the table's
|
Closes #315.
Update CHANGELOG with information about the feature and ref to this PR/issue
New tests for the feature
Visual tests for the column actions
Documentation (
clearableusage, action icon override through CSS & table css prop)Adds the ability to clear column (columns when merged) content without deleting the column itself.
When the
clearaction is done, the associated filters are also cleared. The behavior ofdeleteas been made the same as forclearwith regard to the fitlers.some code rework to share filter state between FilterFactory and HeaderFactory now that header actions tie in with filtering
Re-using the currently in review changes done by @alinastarkov to have a different behavior based on whether columns are merged or not (https://github.com/plotly/dash-table/blob/f69106e5a9639ab1f7831f4cdabb0860bd1579f0/src/dash-table/utils/actions.js)