react-csv icon indicating copy to clipboard operation
react-csv copied to clipboard

I tried using this new enclosingCharacter prop but it does not seem to work.

Open Tonytonyy opened this issue 6 years ago • 6 comments

I tried using this new enclosingCharacter prop but it does not seem to work. I used it like explained in the README, that is with the following code:

<CSVLink data={csvData} separator=';' filename={csvName} enclosingCharacter={'}> {/* my button */} </CSVLink>

In the resulting downloaded CSV file, the enclosing characters are the default ones, that is double-quotes.

I read the files modified in this PR and everything seems OK. Could someone tell me if I am using it the wrong way?

Thanks in advance 😊

Tonytonyy avatar Nov 28 '19 08:11 Tonytonyy

I also have same issue. Please someone provide solution for this.

pradeepMalvi89 avatar Dec 12 '19 07:12 pradeepMalvi89

it seems I found solution in component/link.js, enclosingCharacter parameter was not delivered correctly.

key: 'componentWillReceiveProps', value: function componentWillReceiveProps(nextProps) { var data = nextProps.data, headers = nextProps.headers, separator = nextProps.separator, uFEFF = nextProps.uFEFF, enclosingCharacter = nextProps.enclosingCharacter;

this.setState({ href: this.buildURI(data, uFEFF, headers, separator, enclosingCharacter) });

bosscq avatar Dec 12 '19 08:12 bosscq

@bosscq seems correct. I will put a PR up to fix.

mccabemj avatar Dec 23 '19 14:12 mccabemj

@bosscq seems correct. I will put a PR up to fix.

thx

Tonytonyy avatar Dec 29 '19 09:12 Tonytonyy

hey folks! any update on this? just curious as encountered the same issue..

tanmayrajani avatar Jun 02 '20 10:06 tanmayrajani

it's missing "enclosingCharacter" in the new version

  componentDidUpdate(prevProps) {
    if (this.props !== prevProps) {
      const { data, headers, separator, uFEFF } = this.props;
      this.setState({ href: this.buildURI(data, uFEFF, headers, separator) });
    }
  }

I also create it as a new issue https://github.com/react-csv/react-csv/issues/241

dieuit07 avatar Jul 24 '20 10:07 dieuit07