From d7af8d97c77fa8cafadf2e15f4539657833d5ad3 Mon Sep 17 00:00:00 2001
From: juanf <juanf>
Date: Mon, 27 Apr 2015 14:30:31 +0000
Subject: [PATCH] SSDM-1724 : Plate View (ongoing work)

SVN: 33915
---
 .../js/views/SampleForm/widgets/PlateController.js    | 11 ++++-------
 .../eln-lims/html/js/views/legacy/SampleHierarchy.js  |  8 ++++++++
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateController.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateController.js
index 84e40b25e88..846f015eefd 100644
--- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateController.js
+++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/SampleForm/widgets/PlateController.js
@@ -18,18 +18,15 @@ function PlateController(sample) {
 	this._plateModel = new PlateModel(sample);
 	this._plateView = new PlateView(this, this._plateModel);
 	
+	this.getPlaceHolderId = function() {
+		return this._plateModel.getPlaceHolderId();
+	}
+	
 	this.getPlaceHolder = function() {
 		return this._plateView.getPlaceHolder();
 	}
 	
 	this.initWithPlaceHolder = function() {
-		//Delete old view for redraws - Corner Case
-		var oldPlaceHolderFound = $("#" + this._plateModel.getPlaceHolderId());
-		if(oldPlaceHolderFound.length !== 0) {
-			oldPlaceHolderFound.remove();
-		}
-		
-		//Normal case
 		var _this = this;
 		var repeatUntilSet = function() {
 			var placeHolderFound = $("#" + _this._plateModel.getPlaceHolderId());
diff --git a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleHierarchy.js b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleHierarchy.js
index c25576a967b..f9ed86a7d5d 100644
--- a/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleHierarchy.js
+++ b/plasmid/source/core-plugins/eln-lims/1/as/webapps/eln-lims/html/js/views/legacy/SampleHierarchy.js
@@ -331,6 +331,14 @@ function SampleHierarchy(serverFacade, containerId, profile, sample) {
 					
 					if(sample.sampleTypeCode === "PLATE") {
 						var plateController = new PlateController(sample);
+						
+						//Delete old view for redraws - Corner Case
+						var oldPlaceHolderFound = $("#" + plateController.getPlaceHolderId());
+						if(oldPlaceHolderFound.length !== 0) {
+							oldPlaceHolderFound.remove();
+						}
+						
+						//Normal plate draw using place holder for the svg graph size calculations 
 						$nodeContent.append(plateController.getPlaceHolder());
 						plateController.initWithPlaceHolder();
 					}
-- 
GitLab