From 4c13c7324a920f5cca9601154e5224e5d7484fa9 Mon Sep 17 00:00:00 2001
From: rsanchez <rsanchez@curisit.net>
Date: Fri, 12 Dec 2014 18:09:27 +0000
Subject: [PATCH] #2140 fix - Many changes related with cahce and JPA cycling relationships

---
 securis/src/main/webapp/js/admin.js |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/securis/src/main/webapp/js/admin.js b/securis/src/main/webapp/js/admin.js
index 3d320fa..387a333 100644
--- a/securis/src/main/webapp/js/admin.js
+++ b/securis/src/main/webapp/js/admin.js
@@ -69,10 +69,7 @@
 
 				$scope.selectCatalog = _changeCatalog;
 				
-				$scope.edit = function(data) {
-					$scope.showForm = true;
-					$scope.isNew = false;
-					// Next line is a workaround due to some issues with values with ID == 0
+				$scope._loadFormu = function(elementData) {
 					$('select').val(null);
 					$scope.formu = {}
 					var fields = Catalogs.getMetadata().fields;
@@ -83,13 +80,23 @@
 							// next lines are a workaround to avoid an issue where we try to show a form with "select" fields (if select field value doesn't change
 							$scope.formu[field.name] = null;
 							setTimeout(function() {
-								$scope.formu[field.name] = data[field.name];
+								$scope.formu[field.name] = elementData[field.name];
 								$scope.$apply();
 							}, 0);
 						} else {
-							if (!field.listingOnly) $scope.formu[field.name] = data[field.name] || null;
+							if (!field.listingOnly) $scope.formu[field.name] = elementData[field.name] || null;
 						}
 					})
+				}
+				
+				$scope.edit = function(data) {
+					$scope.showForm = true;
+					$scope.isNew = false;
+					$scope._loadFormu(data);
+					Catalogs.get(data[Catalogs.getPk()], function(eleData) {
+						$scope._loadFormu(eleData);
+					});
+					// Next line is a workaround due to some issues with values with ID == 0
 					setTimeout(function() {
 						$('#'+Catalogs.getFFF()).focus();
 					}, 0);

--
Gitblit v1.3.2