Commit e5470295848b45f3dd3606736a808f705461c54b
1 parent
3a31bb7b
Implemented alphabetical functionality
Showing
1 changed file
with
17 additions
and
4 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js
... | ... | @@ -1190,10 +1190,22 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou |
1190 | 1190 | .from($scope.AAPinTermData) |
1191 | 1191 | .where('_LanguageId == ' + primaryLexicon) |
1192 | 1192 | .select(); |
1193 | - | |
1193 | + var sortedTermTextArray = []; | |
1194 | 1194 | for (var i = 0; i < $scope.matchedLanguageTermData.length; i++) { |
1195 | - $scope.pinTermData.push({ "LanguageId": $scope.matchedLanguageTermData[i]._LanguageId, "TermNumber": $scope.matchedLanguageTermData[i]._TermNumber, "TermTxt": $scope.matchedLanguageTermData[i]._TermText}); | |
1195 | + sortedTermTextArray.push($scope.matchedLanguageTermData[i]._TermText); | |
1196 | + sortedTermTextArray.sort(); | |
1197 | + } | |
1198 | + | |
1199 | + for (var i = 0; i <= sortedTermTextArray.length - 1; i++) { | |
1200 | + for(var j = 0;j<= $scope.matchedLanguageTermData.length-1;j++){ | |
1201 | + if ($scope.matchedLanguageTermData[j]._TermText == sortedTermTextArray[i]) | |
1202 | + { | |
1203 | + $scope.pinTermData.push({ "LanguageId": $scope.matchedLanguageTermData[j]._LanguageId, "TermNumber": $scope.matchedLanguageTermData[j]._TermNumber, "TermTxt": $scope.matchedLanguageTermData[j]._TermText }); | |
1204 | + break; | |
1205 | + } | |
1206 | + } | |
1196 | 1207 | } |
1208 | + | |
1197 | 1209 | $scope.$watch('$scope.pinTermData', function (newValue, oldValue, scope) { |
1198 | 1210 | if ($('#termlistfilter').html() != "") |
1199 | 1211 | $('#termList').empty(); |
... | ... | @@ -1240,9 +1252,10 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou |
1240 | 1252 | |
1241 | 1253 | $scope.refreshTermListOnSystemSelection = function (bodySystemId) { |
1242 | 1254 | var bodySystemName = $("#bodySystems #" + bodySystemId).val(); |
1243 | - | |
1255 | + $('#termList').empty(); | |
1244 | 1256 | if (bodySystemName == "All") { |
1245 | 1257 | for (var j = 0; j <= $scope.pinTermData.length - 1; j++) { |
1258 | + | |
1246 | 1259 | var $selectedOptions = $('<option id= "' + $scope.pinTermData[j].TermNumber + '" >' + $scope.pinTermData[j].TermTxt + '</option>').appendTo("#termList") |
1247 | 1260 | $compile($selectedOptions)($scope); |
1248 | 1261 | } |
... | ... | @@ -1251,7 +1264,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou |
1251 | 1264 | var imageId = $rootScope.imageId; |
1252 | 1265 | $scope.pinDataUrl = "aa_dat_pinterm_" + imageId; |
1253 | 1266 | $rootScope.bodySystemTermArray = []; |
1254 | - $('#termList').empty(); | |
1267 | + | |
1255 | 1268 | $.ajax({ |
1256 | 1269 | url: '~/../content/data/json/aa/aa_pinterm/' + $scope.pinDataUrl + '.json', |
1257 | 1270 | type: 'GET', | ... | ... |