Need a special offer?Find out if your project fits.
+

Angular4: Update Record property according to input parameters

Answered
Frederico Costa asked on March 6, 2018

Hi FlexMonster team!
 
First of all, congratuations for the excelent product!
I am using flexmonster in a Demo to a customer, and using Angular4. I need to get a variable (an index, for instance), and customize the [report] property according to it. I tried using "FlexmonsterPivot.prototype.report" at my ngOnInit() function, but it fails 🙁

<fm-pivot [componentFolder]="'https://cdn.flexmonster.com/'"
[toolbar]="true"
[width]="'100%'"
[height]="500"
[report]="{
dataSource: {
dataSourceType: 'ocsv',
filename: 'http://flex.Myserver.me/server/query.php'
}
}"
[global]="onGLobal"
>
PlaceHolder 1
</fm-pivot>

Thanks,
Frederico
 

3 answers

Public
Dmytro Zvazhii Dmytro Zvazhii Flexmonster March 6, 2018

Hello Frederico, 
Thank you for writing. Please have a look at our Angular4 integration tutorial - https://www.flexmonster.com/doc/integration-with-angular/, there you can find the reference to the GitHub repository with the sample project. In app.component.ts file you can see the example of using Flexmonster's setReport() API call. Please find more information about available API calls in our docs - https://www.flexmonster.com/api/setreport/.
Let us know if the information above was helpful for you.
Regards,
Dmytro

Public
Frederico Costa March 6, 2018

Thanks Dmytro!
 
Your solution is elegant and fast! But as I am using routes (<component>/:<queryid>, for instance: view/1, view/2 etc) to identify the queryId, the onReportComplete Event is only executed when the Component is first entered. Any Ideias on how to solve this?
BTW, I will use you solution at another situation i have, thanks very much!!!
 
Best Regards,
Frederico

Public
Tanya Gryshko Tanya Gryshko Flexmonster March 7, 2018

Hello, Frederico,
Our team is really glad that previously suggested solution is useful for your project!
As about customizing the [report] property, please try the following approach:
every time when queryId is changed, please use setReport() API call. setReport() will set new report for the component, i.e. change the [report] property. Check how setReport() should be called and which properties report may contain
Please share your feedback with us! 
Regards,
Tanya

Please login or Register to Submit Answer