Trigger 'rendered' event also on page loads

This commit is contained in:
Johannes Meyer 2014-04-01 10:40:38 +02:00
parent 14ed3b6fe2
commit 758fd06cfe

View File

@ -76,6 +76,9 @@
// We catch resize events // We catch resize events
$(window).on('resize', { self: this.icinga.ui }, this.icinga.ui.onWindowResize); $(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 // Destroy Icinga, clean up and interrupt pending requests on unload
$( window ).on('unload', { self: this }, this.onUnload); $( window ).on('unload', { self: this }, this.onUnload);
$( window ).on('beforeunload', { self: this }, this.onUnload); $( window ).on('beforeunload', { self: this }, this.onUnload);
@ -192,6 +195,10 @@
} }
}, },
onLoad: function (event) {
$('.container').trigger('rendered');
},
onUnload: function (event) { onUnload: function (event) {
var icinga = event.data.self.icinga; var icinga = event.data.self.icinga;
icinga.logger.info('Unloading Icinga'); icinga.logger.info('Unloading Icinga');
@ -397,6 +404,7 @@
unbindGlobalHandlers: function () { unbindGlobalHandlers: function () {
$(window).off('resize', this.onWindowResize); $(window).off('resize', this.onWindowResize);
$(window).off('load', this.onLoad);
$(window).off('unload', this.onUnload); $(window).off('unload', this.onUnload);
$(window).off('beforeunload', this.onUnload); $(window).off('beforeunload', this.onUnload);
$(document).off('scroll', '.container', this.onContainerScroll); $(document).off('scroll', '.container', this.onContainerScroll);