Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- [#618](https://github.com/plotly/dash-table/issues/618) Fix a bug with keyboard navigation not
working correctly in certain circumstances when the table contains `readonly` columns.

- [#206](https://github.com/plotly/dash-table/issues/206) Fix a bug with copy/paste to and from
column filters not working.

## [4.4.0] - 2019-10-08
### Added
[#546](https://github.com/plotly/dash-table/issues/546)
Expand Down
6 changes: 6 additions & 0 deletions src/core/components/IsolatedInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { KEY_CODES } from 'dash-table/utils/unicode';
type Submit = (value: string | undefined) => void;

interface IProps {
onCopy?: (e: any) => void;
onPaste?: (e: any) => void;
placeholder?: string;
updateOnBlur?: boolean;
updateOnSubmit?: boolean;
Expand Down Expand Up @@ -84,6 +86,8 @@ export default class IsolatedInput extends PureComponent<IProps, IState> {

render() {
const {
onCopy,
onPaste,
placeholder,
updateOnBlur,
updateOnSubmit
Expand All @@ -100,6 +104,8 @@ export default class IsolatedInput extends PureComponent<IProps, IState> {
type='text'
value={this.state.value || ''}
onChange={this.handleChange}
onCopy={onCopy}
onPaste={onPaste}
placeholder={placeholder}
{...props}
/>);
Expand Down
8 changes: 8 additions & 0 deletions src/dash-table/components/Filter/Column.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React, { CSSProperties, PureComponent } from 'react';
import IsolatedInput from 'core/components/IsolatedInput';

import { ColumnId } from 'dash-table/components/Table/props';
import TableClipboardHelper from 'dash-table/utils/TableClipboardHelper';

type SetFilter = (ev: any) => void;

Expand Down Expand Up @@ -51,6 +52,13 @@ export default class ColumnFilter extends PureComponent<IColumnFilterProps, ISta
style={style}
>
<IsolatedInput
onCopy={(e: any) => {
e.stopPropagation();
TableClipboardHelper.clearClipboard();
}}
onPaste={(e: any) => {
e.stopPropagation();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prevent copy/paste from being handled by the global table handler

}}
value={value}
placeholder={`filter data...`}
stopPropagation={true}
Expand Down
5 changes: 5 additions & 0 deletions src/dash-table/utils/TableClipboardHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ export default class TableClipboardHelper {
Clipboard.set(e, value);
}

public static clearClipboard() {
TableClipboardHelper.lastLocalCopy = [];
TableClipboardHelper.localCopyWithoutHeaders = [];
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deal with the special table copy/paste code -- reset the previsouly set copies -- will pick up the last copy event normally when doing a paste from filter columns.


public static fromClipboard(
ev: ClipboardEvent,
activeCell: ICellCoordinates,
Expand Down