From 8ee51a77215bc56ded9ac7da7a73ce27b6cebe2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93scar=20Gonz=C3=A1lez=20Fern=C3=A1ndez?= Date: Thu, 30 Jun 2011 19:47:49 +0200 Subject: [PATCH] [Bug #1103] Fix bug this._timeplotcontainer was not being initialized correctly since the ready event is not always produced. Now it is queried instead of initializing it at the start. FEA: ItEr75S08MigrationZK5 --- .../main/resources/web/js/ganttz/GanttPanel.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ganttzk/src/main/resources/web/js/ganttz/GanttPanel.js b/ganttzk/src/main/resources/web/js/ganttz/GanttPanel.js index a36426d91..97800b9f4 100644 --- a/ganttzk/src/main/resources/web/js/ganttz/GanttPanel.js +++ b/ganttzk/src/main/resources/web/js/ganttz/GanttPanel.js @@ -29,7 +29,7 @@ ganttz.GanttPanel = zk.$extends(zk.Widget,{ return [first, first.parentNode, first.parentNode.parentNode]; }, timeplotContainerRescroll : function(){ - this._timeplotcontainer.each(jq.proxy(function(index, element){ + this._getTimeplotContainer().each(jq.proxy(function(index, element){ jq(element).css("left", "-" + this._rightpannellayout.scrollLeft() + "px") }, this)); }, @@ -48,14 +48,13 @@ ganttz.GanttPanel = zk.$extends(zk.Widget,{ this._plannergraph.scrollLeft( this._rightpannellayout.scrollLeft() ); this.timeplotContainerRescroll(); }, + /*The canvas is inserted in the DOM after this component so + * it's not available right now. It is queried instead. Using throttle + * to not re-query it constantly */ + _getTimeplotContainer: common.Common.throttle(500, function() { + return jq('canvas.timeplot-canvas'); + }), _initializeProperties : function(){ - /*The canvas is inserted in the DOM after this component so - * it's not available right now. We set up a handler to do - * job*/ - jq(document).ready(jq.proxy( - function(){ this._timeplotcontainer = jq('canvas.timeplot-canvas'); - },this)); - this._timetrackergap = jq('.timetrackergap'); this._rightpannellayout = jq('.rightpanellayout div:first'); this._taskdetails = jq('.listdetails .z-tree-body');