Flexmonster MCP Server is here! Connect your ✨AI assistant to our documentation. Get started
+

infinte loop for flexmonster.on reportcomplete

Answered
sabby sabby asked on September 6, 2017

<FlexmonsterReact.Pivot id="pivot-container" ref ="pivot" toolbar = "true"
beforetoolbarcreated = {this.customizeToolbar}
reportcomplete = {this.setWidth}
I am trying to set the width of column to specific value but it goes to many loops 
 
setWidth = ()=>{
console.log("changing with ");
var report = window.flexmonster.getReport();
report["tableSizes"] = {"columns":[{"idx":0,"width":80},{"idx":1,"width":100}]};
window.flexmonster.setReport(report);
}
 

is there other way to do so ? 
i tried
flexmonster.on('reportcomplete', function () {
alert('Report completed!');  setwidth  // this causes infinte loop too
});
 
Is there any other event i can use to set width of column?

3 answers

Public
sabby sabby ⋅ September 6, 2017

  window.flexmonster.tableSizes({"columns":[{"idx":0,"width":80},{"idx":1,"width":100}]});    we dont have something like this right ?

Public
Tanya Gryshko Tanya Gryshko ⋅ Flexmonster ⋅ September 7, 2017

Hello Sabby,
Thank you for writing. Please try adding window.flexmonster.off("reportcomplete"); after window.flexmonster.setReport(report);. off() API call removes JS handlers for the specified event so there will be no infinite loop. Let me know if it helps.
Regards,
Tanya

Public
sabby sabby ⋅ September 7, 2017

thanks it works perfectly now. thank you 

Please sign in or register to submit your answer