[Piwik-svn] r215 - trunk/plugins/Home/templates

svnmaster at piwik.org svnmaster at piwik.org
Sun Jan 20 13:29:39 CET 2008


Author: julien
Date: 2008-01-20 13:29:38 +0100 (Sun, 20 Jan 2008)
New Revision: 215

Modified:
   trunk/plugins/Home/templates/datatable.js
Log:
Correction of a bug in datatable.js when the script is loaded multiple time

Modified: trunk/plugins/Home/templates/datatable.js
===================================================================
--- trunk/plugins/Home/templates/datatable.js	2008-01-20 07:13:09 UTC (rev 214)
+++ trunk/plugins/Home/templates/datatable.js	2008-01-20 12:29:38 UTC (rev 215)
@@ -2,7 +2,9 @@
 //								Data Table
 //-----------------------------------------------------------------------------
 //A list of all our datatables
-var dataTables = new Object;
+//Test if the object have already been initialized (multiple includes)
+if(typeof dataTables == "undefined")
+	var dataTables = new Object;
 
 //On document ready we create a JS object for every datatable in the page
 $(document).ready( createAllDataTableObjects );
@@ -18,7 +20,8 @@
 			// ID of the DIV containing the DataTable we are currently working on
 			var workingDivId = $(this).attr('id');
 			var self = dataTables[workingDivId];
-			self.init(workingDivId, this);
+			if(!self.initialized)
+				self.init(workingDivId, this);
 		}
 	);
 	
@@ -28,7 +31,8 @@
 		{
 			var workingDivId = $(this).attr('id');
 			var self = actionDataTables[workingDivId];
-			self.init(workingDivId, this);
+			if(!self.initialized)
+				self.init(workingDivId, this);
 		}
 	);
 }
@@ -48,6 +52,7 @@
 			this.workingDivId = workingDivId;
 			this.loadedSubDataTable = new Object;
 			this.bindEvent(domElem);
+			this.initialized = true;
 	},
 			
 	onClickSort: function(domElem)
@@ -621,7 +626,9 @@
 
 
 //A list of all our actionDataTables
-var actionDataTables = new Object;
+//Test if the object have already been initialized (multiple includes)
+if(typeof actionDataTables == "undefined")
+	var actionDataTables = new Object;
 
 //actionDataTable constructor
 function actionDataTable()
@@ -645,6 +652,7 @@
 	{
 			this.workingDivId = workingDivId;
 			this.bindEvent(domElem);
+			this.initialized = true;
 	},
 
 	bindEvent: function(domElem)



More information about the Piwik-svn mailing list