How to save report on reportchange function in react>

Closed

I have been followed https://github.com/WebDataRocks/pivot-react this tutorial.
It has been implemented successfully.
Now I want to save report structure json on reportcomplete . I use following code

<WebDataRocksReact.Pivot toolbar={true}  reportcomplete={ ()=>{ this.onChange() } } report="https://cdn.webdatarocks.com/reports/report.json"/>

In the onChange function, How do I get Webdatarocks object , so that I can save the report manually?
thanks
 
 

4 answers

WebDataRocks Team WebDataRocks March 27, 2019

Hello Nandan,
 
Thank you for the question.
You need to create a reference to the component to access it.
Please refer to the documentation for more details: https://reactjs.org/docs/refs-and-the-dom.html
Then, you can access the API methods via this.myRef.current.webdatarocks (e.g. this.myRef.current.webdatarocks.getReport()).
 
Hope it helps.
 
Regards,
WebDataRocks Team
 
 

NANDAN BARMAN March 27, 2019

Thanks for reply.
But unfortunately I am using react version 15.03. 
 
Please tell me how to save report.js to the sever on changeing. Is there any other way ?
 
 

WebDataRocks Team WebDataRocks March 29, 2019

Hello Nandan,
 
I guess there are ways to create a reference in React 15.03 as well (e.g. https://reactjs.org/docs/refs-and-the-dom.html#callback-refs )
 
As for the saving report on changing, you need to subscribe to reportchange event and then call save() method on every update.
 
Hope it helps.
 
Regards,
WebDataRocks Team

NANDAN BARMAN March 29, 2019

Thanks. I did it..

This question is now closed