How to save report on reportchange function in react>


I have been followed 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=""/>

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

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:
Then, you can access the API methods via this.myRef.current.webdatarocks (e.g. this.myRef.current.webdatarocks.getReport()).
Hope it helps.
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. )
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.
WebDataRocks Team

NANDAN BARMAN March 29, 2019

Thanks. I did it..

This question is now closed