AllenFang / AllenFang/react-bootstrap-table

Export csv with selected rows in react-bootstrap-table

Ouverte
#1,980 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
JavaScript
Étoiles
2.2k
Forks
761
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

How can i export selected rows as csv file in react-bootstrap-table ? i'm using ^4.0.1 version

this is my code snippet.

const selectedForms = [];

function onRowSelect(row, isSelected) {
if (isSelected) {
selectedForms.push(row.id);
} else {
selectedForms.splice((selectedForms.indexOf(row.id)), 1);
}
console.log(selectedForms.toString());
}

const selectRowProp = {
mode: 'checkbox',
onSelect: onRowSelect,
};

{
this.props.history.push(`/form/${row.id}`);
},
onExportToCSV: () => {
return this.props.forms.map(form => (selectedForms.indexOf(form.id) > -1));
},
}}
selectRow={selectRowProp}
>
Subscriber form ID
Column1
Column2
Column3
Column4

This is the erro message i'm getting :
Uncaught TypeError: Cannot read property 'length' of undefined
at o (csv_export_util.js:24)
at i (csv_export_util.js:80)
at t.value (BootstrapTable.js:1392)
at Object.n.handleExportCSV [as onExportCSV] (BootstrapTable.js:160)
at t.value (ToolBar.js:353)
at o.handleExportCSV (ToolBar.js:139)
at Object.h (react-dom.production.min.js:36)
at Object.invokeGuardedCallback (react-dom.production.min.js:35)
at Object.invokeGuardedCallbackAndCatchFirstError (react-dom.production.min.js:35)
at b (react-dom.production.min.js:36)

Guide de contribution

Ouvrir le guide de contribution

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.