0

In a page I display charts (chart.js) and I have to use window.onload JS for loading. The page is called by p: commandLink but window.onload does not work. I did not find a solution on the web. Can you help me please ? Thank you. My code:

<p:commandLink value="Espace standard" 
                           style="position: absolute; top: 455px; left: 700px"
                           action="pageGraphiqueEspaceStandard.xhtml" 
                           actionListener="#{utilitaireManagerBean.initialiserPageCourante('graphiqueEspaceStandard')}"/>

<script type="text/javascript">
                window.onload = function ()
                {
                    drawChart('espaceStandardGraphique1', 'idCanvasGraphique1');
                    drawChart('espaceStandardGraphique2', 'idCanvasGraphique2')
                };
</script
Kukeltje
  • 12,223
  • 4
  • 24
  • 47
  • I found a solution with window.onload by adding ajax = false to call the page, but a blank page appears briefly before displaying the page correctly! How to disappear this blank page? – Denis Duval Nov 27 '19 at 07:46
  • Make use of [document.onload](https://stackoverflow.com/questions/588040/window-onload-vs-document-onload) instead of [window.onload](https://stackoverflow.com/questions/588040/window-onload-vs-document-onload) and give it a try. – Harihara_K Feb 26 '20 at 13:23
  • I tried document.onload instead of window.onload but it doesn't work. – Denis Duval Feb 27 '20 at 14:43

0 Answers0