RELEASE 🚒 : 1.0.2
Ability of specifying the "filename" of the downloaded CSV file .
```
<CSVLink filename={"persons.csv"} data={data}>Click here</CSVLink>
```
This commit is contained in:
parent
c5053cf334
commit
d4544e117e
9 changed files with 4259 additions and 27 deletions
|
|
@ -19,9 +19,9 @@ class CSVLink extends React.Component {
|
|||
}
|
||||
|
||||
render(){
|
||||
const {data, headers, separator, children , ...rest} = this.props;
|
||||
const {data, headers, separator, filename, children , ...rest} = this.props;
|
||||
return (
|
||||
<a {...rest}
|
||||
<a download={filename} {...rest}
|
||||
href={this.buildURI(data, headers, separator)}>
|
||||
{children}
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -8,11 +8,13 @@ export const propTypes = {
|
|||
]).isRequired,
|
||||
headers: React.PropTypes.array,
|
||||
target: React.PropTypes.string,
|
||||
separator: React.PropTypes.string
|
||||
separator: React.PropTypes.string,
|
||||
filename: React.PropTypes.string
|
||||
};
|
||||
|
||||
export const defaultProps = {
|
||||
separator: ','
|
||||
separator: ',',
|
||||
filename: 'generatedBy_react-csv.csv'
|
||||
};
|
||||
|
||||
export const PropsNotForwarded = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue