React exportToPDF


#1

I am trying to figure out how to fix the error:

GanttChart.tsx:1244 Uncaught TypeError: gantt.exportToPDF is not a function
at GanttChart.xyzJ.GanttChart._exportPDF (GanttChart.tsx:1244)
at onClick (GanttChart.tsx:180)
at HTMLUnknownElement.callCallback (react-dom.development.js:149)
at Object.invokeGuardedCallbackDev (react-dom.development.js:199)
at invokeGuardedCallback (react-dom.development.js:256)
at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:270)
at executeDispatch (react-dom.development.js:561)
at executeDispatchesInOrder (react-dom.development.js:583)
at executeDispatchesAndRelease (react-dom.development.js:680)
at executeDispatchesAndReleaseTopLevel (react-dom.development.js:688)
at forEachAccumulated (react-dom.development.js:662)
at runEventsInBatch (react-dom.development.js:816)
at runExtractedEventsInBatch (react-dom.development.js:824)
at handleTopLevel (react-dom.development.js:4826)
at batchedUpdates$1 (react-dom.development.js:20404)
at batchedUpdates (react-dom.development.js:2151)


#2

Hello,
To import and export the data, you need to include the export’s api.js file:
https://docs.dhtmlx.com/gantt/desktop__export.html
In React, Angular, and other frameworks, it would be easier to save it locally and import it on the page.

Here is a React demo with that approach:
https://files.dhtmlx.com/30d/9f1198f54ba3138e66a6877e35d7366e/react+export_7.0.1.zip
You need to copy the api.js from src to node_modules/dhtmlx-gantt/codebase/