From 758fd06cfe48b092227141e32ca86c7e01f63705 Mon Sep 17 00:00:00 2001
From: Johannes Meyer <johannes.meyer@netways.de>
Date: Tue, 1 Apr 2014 10:40:38 +0200
Subject: [PATCH] Trigger 'rendered' event also on page loads

---
 public/js/icinga/events.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/public/js/icinga/events.js b/public/js/icinga/events.js
index f1a7cf729..614b85c38 100644
--- a/public/js/icinga/events.js
+++ b/public/js/icinga/events.js
@@ -76,6 +76,9 @@
             // We catch resize events
             $(window).on('resize', { self: this.icinga.ui }, this.icinga.ui.onWindowResize);
 
+            // Trigger 'rendered' event also on page loads
+            $(window).on('load', { self: this }, this.onLoad);
+
             // Destroy Icinga, clean up and interrupt pending requests on unload
             $( window ).on('unload', { self: this }, this.onUnload);
             $( window ).on('beforeunload', { self: this }, this.onUnload);
@@ -192,6 +195,10 @@
             }
         },
 
+        onLoad: function (event) {
+            $('.container').trigger('rendered');
+        },
+
         onUnload: function (event) {
             var icinga = event.data.self.icinga;
             icinga.logger.info('Unloading Icinga');
@@ -397,6 +404,7 @@
 
         unbindGlobalHandlers: function () {
             $(window).off('resize', this.onWindowResize);
+            $(window).off('load', this.onLoad);
             $(window).off('unload', this.onUnload);
             $(window).off('beforeunload', this.onUnload);
             $(document).off('scroll', '.container', this.onContainerScroll);