JS code is working but not reflecting in the DOM.

Hi Devs, I am facing an issue where the setTimeout function from the Javascript snippet is not reflecting in the DOM. where my scenario is to expand the chart on onClick function and it needs to be downloaded and again it needs to achieve its same state after sometime again the page needs to be automatically reloaded after sometime using 2 setTimeOut functions without using setTimeOut function the page is reloading but on the usage of setTimeOut function it is not. using the same code snippet in the Codepen or JSfiddle its working and the changes are getting reflected but in mendix code is working but not reflecting.   The JS which I used is shown below,   function myJS() {     FusionCharts.items["mychart"].setChartAttribute({       "ganttPaneDurationUnit": "",       "ganttPaneDuration": "",       "useVerticalScrolling": "0"     });     FusionCharts.items['mychart'].resizeTo("1000", "350");     DrawCompleteFunc();   }   function DrawCompleteFunc() {     if (FusionCharts.items["mychart"].width == '1000') //to check if it is called after chart is redrawn     {       setTimeout(function() {         FusionCharts("mychart").exportChart({           exportFormat: 'jpg'         });       }, 1500);       setTimeout(function() {         FusionCharts.items['mychart'].resizeTo("550", "350");       }, 5000);       setTimeout(function() {       window.location.reload();       },5000);     }   }   document.getElementById("export").addEventListener("click", myJS);   Thanks in Advance.
1 answers

Hi Attar,


If you are using the same IDs then the same chart will be downloaded. Try using different IDs for different charts then the above issue will be resolved.