Reopening bug #459. Bug still exists:
Using the following versions:
"react-bootstrap-table-next": "^3.3.1",
"react-bootstrap-table2-editor": "^1.4.0",
"react-bootstrap-table2-paginator": "^2.0.7",
"react-bootstrap-table2-toolkit": "^2.1.2",
Code:
data={ this.state.students }
columns={ Columns }
exportCSV
exportAll="false"
>
{
props => (
Pressing "Export to CSV" button returns following console error:
Uncaught TypeError: Cannot read property 'get' of null
at :3000/static/js/0.chunk.js:168336
at Array.map (
at :3000/static/js/0.chunk.js:168335
at Array.map (
at transform (:3000/static/js/0.chunk.js:168334)
at CSVOperation._this.handleExportCSV (:3000/static/js/0.chunk.js:168538)
at onClick (:3000/static/js/0.chunk.js:168250)
at HTMLUnknownElement.callCallback (:3000/static/js/0.chunk.js:185718)
at Object.invokeGuardedCallbackDev (:3000/static/js/0.chunk.js:185767)
at invokeGuardedCallback (:3000/static/js/0.chunk.js:185820)
at invokeGuardedCallbackAndCatchFirstError (:3000/static/js/0.chunk.js:185835)
at executeDispatch (:3000/static/js/0.chunk.js:185920)
at executeDispatchesInOrder (:3000/static/js/0.chunk.js:185945)
at executeDispatchesAndRelease (:3000/static/js/0.chunk.js:188829)
at executeDispatchesAndReleaseTopLevel (:3000/static/js/0.chunk.js:188838)
at forEachAccumulated (:3000/static/js/0.chunk.js:188810)
at runEventsInBatch (:3000/static/js/0.chunk.js:188855)
at runExtractedPluginEventsInBatch (:3000/static/js/0.chunk.js:189065)
at handleTopLevel (:3000/static/js/0.chunk.js:189109)
at batchedEventUpdates$1 (:3000/static/js/0.chunk.js:207255)
at batchedEventUpdates (:3000/static/js/0.chunk.js:186327)
at dispatchEventForLegacyPluginEventSystem (:3000/static/js/0.chunk.js:189119)
at attemptToDispatchEvent (:3000/static/js/0.chunk.js:189839)
at dispatchEvent (:3000/static/js/0.chunk.js:189760)
at unstable_runWithPriority (:3000/static/js/0.chunk.js:211416)
at runWithPriority$1 (:3000/static/js/0.chunk.js:196605)
at discreteUpdates$1 (:3000/static/js/0.chunk.js:207272)
at discreteUpdates (:3000/static/js/0.chunk.js:186340)
at dispatchDiscreteEvent (:3000/static/js/0.chunk.js:189739)
Changing line 44 of +react-bootstrap-table2-toolkit\lib\src\csv\exporter.js from:
var cellContent = _.get(row, m.field);
to
var cellContent = row[m.field];
corrects issue.
your example is broken. please create a simple and minimal example on codesandbox so that I can help u efficiently. thanks
Hi,
Here is a codesandbox showing the issue with react-bootstrap-table2-toolkit-2.1.3,
https://codesandbox.io/s/agitated-shaw-5t0jj
And the fix suggested by _ahiltgen_ works. I manually changed the code in /node_modules/react-bootstrap-table2-toolkit/dist/react-bootstrap-table2-toolkit.js, and npm start, then it works correctly on clicking the export csv button.
Why is this issue closed? It has not been fixed.
Hi,
Here is a codesandbox showing the issue withreact-bootstrap-table2-toolkit-2.1.3,
https://codesandbox.io/s/agitated-shaw-5t0jj
And the fix suggested by _ahiltgen_ works. I manually changed the code in/node_modules/react-bootstrap-table2-toolkit/dist/react-bootstrap-table2-toolkit.js, andnpm start, then it works correctly on clicking the export csv button.
Thank you for posting the codesandbox example.
Changing line 44 of +react-bootstrap-table2-toolkit\lib\src\csv\exporter.js from:
var cellContent = _.get(row, m.field);
to
var cellContent = row[m.field];corrects issue.
Hi ahiltgen,
It resolve the issue but upon exporting hidden columns are included in exported csv file. Is there any posible way to handle also the hidden columns not to be included.
Most helpful comment
Changing line 44 of +react-bootstrap-table2-toolkit\lib\src\csv\exporter.js from:
var cellContent = _.get(row, m.field);
to
var cellContent = row[m.field];
corrects issue.