You are on the right path thinking about window.onload
But you want an onload event on content inside your Display Template
Available elements you can set on onload
event on:
body, frame, iframe, img, input type="image", link, script, style
source: http://www.w3schools.com/jsref/event_onload.asp
So your DisplayTemplate could use:
<div id='myDisplayTemplate'>
<img src="_layouts/images/blank.gif" onload="loadedTemplate()">
</div>
<script>
function loadTemplate() {
console.info("Image INSIDE" , this.parentNode.id , "loaded");
}
</script>
You are not displaying an image.. you only want the onload
event
You could even do without an image src and use the onerror
event, but that approach might have edge-cases with problems
This trick is also used when you put HTML/JS in a Calculated Column,
see docs: https://www.365csi.nl/vm365com/#/How