Dear visitor, despite all the challenges, our team continues operating at full speed.

We are ready to help with any questions you may have. Please fill out this quick form and we'll get back to you.

Fill the form
Get Free Trial

BUG: null report when calling `getReport()` after `reportchange` event

Answered
eze@wejugo.com asked on July 16, 2020

This only happens when the report has a dataSource type of “api”.
If for example I add the following event handler:

pivot.on('reportchange', ($event) => {
   console.log(pivot.getReport());
});

After certain actions, for example:

  • adding a new field to the report
  • filtering one of the fields

The Pivot.getReport function returns a null report in the event handler.
After other actions like:

  • Sorting
  • Altering options
  • Switching to charts
  • Etc.

The function returns a report as expected.
 
This isn’t the same when the report is a CSV for example, in which case everything works as expected.
This is tested on the latest (2.8.11) version.
 
 

2 answers

Public
Vera Didenko Flexmonster July 16, 2020

Hello, 
 
Thank you for reporting this problem to us. 
 
We have managed to reproduce the issue on our end as well. 
Our team will provide the fix to this issue in the minor release version with the ETA 24th of August.
 
In the meantime, as a workaround, we kindly suggest using a combination of two events: reportchange and reportcomplete
Looking deeper, we have noticed that for the custom data source API, the reportchange event is fired before the changed report object is ready. 
The reportcomplete event can be used to get the changed report object.
Here is a JSFiddle example for illustration: http://jsfiddle.net/flexmonster/qdytz2f5/
 
 
Please let us know if this would work for you. 
Looking forward to your response.
 
Kind regards, 
Vera

Public
eze@wejugo.com July 20, 2020

Ok, thank you for that insight, using reportcomplete in combination works reasonably well as a workaround.

Please login or Register to Submit Answer