Fixed issue with selected users based on user.id rathr than set index. Fixed dataLoad callback not being destroyed after controller routine exits.

This commit is contained in:
Chris Houseknecht
2013-05-06 22:18:44 -04:00
parent ccb732bd69
commit ced96a1bb3
8 changed files with 60 additions and 52 deletions

View File

@@ -167,7 +167,7 @@ function InventoriesAdd ($scope, $rootScope, $compile, $location, $log, $routePa
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
{ hdr: 'Error!', msg: 'Failed to add new user. Post returned status: ' + status });
{ hdr: 'Error!', msg: 'Failed to add new inventory. Post returned status: ' + status });
});
};
@@ -203,8 +203,7 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
LookUpOrganizationInit({ scope: scope });
// After inventory is loaded, retrieve each related set and any lookups
scope.$on('dataLoaded', function() {
scope.$on('inventoryLoaded', function() {
Rest.setUrl(scope['organization_url']);
Rest.get()
.success( function(data, status, headers, config) {
@@ -215,11 +214,10 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
ProcessErrors(scope, data, status, null,
{ hdr: 'Error!', msg: 'Failed to retrieve: ' + scope.orgnization_url + '. GET status: ' + status });
});
for (var set in relatedSets) {
console.log('inventory edit set: ' + set);
scope.search(relatedSets[set].iterator);
}
}
});
// Retrieve detail record and prepopulate the form
@@ -243,7 +241,7 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
RelatedSearchInit({ scope: scope, form: form, relatedSets: relatedSets });
RelatedPaginateInit({ scope: scope, relatedSets: relatedSets });
scope['organization_url'] = data.related.organization;
scope.$emit('dataLoaded');
scope.$emit('inventoryLoaded');
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
@@ -264,7 +262,7 @@ function InventoriesEdit ($scope, $rootScope, $compile, $location, $log, $routeP
})
.error( function(data, status, headers, config) {
ProcessErrors(scope, data, status, form,
{ hdr: 'Error!', msg: 'Failed to update users: ' + $routeParams.id + '. PUT status: ' + status });
{ hdr: 'Error!', msg: 'Failed to update inventory: ' + $routeParams.id + '. PUT status: ' + status });
});
};