Our pure JavaScript Scheduler component


Post by ofirk »

Hi, we recently implemented the PDF Export server and would like to use it but we encounter an error on the client side.

In order to test the feature we added the following config to the scheduler instance:

      pdfExportFeature: {
        exportServer: 'http://<...export server address...>/'
      }

and a function to trigger export:

  onPrintPdf = (schedulerInstance) => {
    schedulerInstance.features.pdfExport.export({
      // Required, set list of column ids to export
      columns : schedulerInstance.columns.map(c => c.id)
    }).then(result => {
      // Response instance and response content in JSON
      let { response } = result;
    });
  }

but we receive the following error in the client:

scheduler.module.js?66cd:177862 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'events')
at eval (scheduler.module.js?66cd:177862:1)
at Array.forEach (<anonymous>)
at SinglePageExporter.collectEvents (scheduler.module.js?66cd:177856:1)
at SinglePageExporter.onRowsCollected (scheduler.module.js?66cd:177674:1)
at async SinglePageExporter.pagesExtractor (scheduler.module.js?66cd:106164:1)
at async SinglePageExporter.getPages (scheduler.module.js?66cd:104926:1)
at async SinglePageExporter.export (scheduler.module.js?66cd:104907:1)
at async PdfExport.export (scheduler.module.js?66cd:106756:1)

how can we resolve this issue?


Post by mats »

Can you please let us know how to reproduce? If you can share a test case we can debug, that would be great. What version are you using?


Post by ofirk »

Unfortunately i cant easily create a test case.

while debugging the collectEvents function I notice that all the items in the rows parameter show as destroyed:

{
    "isDestroying": true,
    "isDestroyed": true,
    "id": 1000650
}

I also notice that the component that holds the scheduler component re-renders after clicking the print button.

could this explain the array of destroyed rows?
if so how do i avoid re-render?


Post by mats »

Very hard to say, try setting a breakpoint (JS or DOM) and see what's going on?


Post by ofirk »

Hi, we finally managed to call the print server but we now receive an error from the server:

{
    "success": false,
    "msg": "Failed to export task",
    "stack": "Error: Failed to export task\n    at Queue.onJobFailed (/usr/local/bryntum-export-to-pdf/src/queue.js:277:28)\n    at Queue.emit (events.js:400:28)\n    at /usr/local/bryntum-export-to-pdf/src/queue.js:393:28\n    at processTicksAndRejections (internal/process/task_queues.js:95:5)"
}

Post by Maxim Gorkovsky »

Hello.
Please check logs in the export server folder, they should shed some light on the problem


Post Reply