Commit 7bb9a43c08110d7ee91b1c8fc49ae91e81291e4c
1 parent
52f05f20
this is solution for the bug AA listmanager sorting after system select
Showing
1 changed file
with
32 additions
and
32 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/TileViewListController.js
... | ... | @@ -1519,7 +1519,7 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou |
1519 | 1519 | if ($rootScope.bodySystemTermArray[j].language == $rootScope.lexiconLanguageArray[0].id) { |
1520 | 1520 | $rootScope.duplicateListArray.push({ "title": $rootScope.bodySystemTermArray[j].text, "id": $rootScope.bodySystemTermArray[j].termNumbr }); |
1521 | 1521 | |
1522 | - $rootScope.sortedListArray.push({ "title": $rootScope.bodySystemTermArray[j].text, "id": $rootScope.bodySystemTermArray[j].termNumbr }); | |
1522 | + | |
1523 | 1523 | |
1524 | 1524 | // console.log($rootScope.bodySystemTermArray); |
1525 | 1525 | } |
... | ... | @@ -1527,38 +1527,38 @@ function ($scope, $window, $rootScope, $compile, $http, $log, $location, $timeou |
1527 | 1527 | } |
1528 | 1528 | } |
1529 | 1529 | } |
1530 | - //var temp = []; | |
1531 | - //console.log($rootScope.duplicateListArray); | |
1532 | - //for (var i = 0; i <= $rootScope.duplicateListArray.length - 1; i++) { | |
1533 | - // var termID = $rootScope.duplicateListArray[i].id; | |
1534 | - // if ($.inArray(termID, temp) == -1) { | |
1535 | - // temp.push(termID); | |
1536 | - // console.log('1'+$rootScope.duplicateListArray[i].title + " " + $rootScope.duplicateListArray[i].id); | |
1537 | - // $rootScope.sortedListArray.push({ "title": $rootScope.duplicateListArray[i].title, "id": termID }); | |
1538 | - // console.log('3' + $rootScope.sortedListArray[i].title + " " + $rootScope.sortedListArray[i].id) | |
1539 | - // } | |
1540 | - //} | |
1541 | - //console.log('2'+$rootScope.sortedListArray); | |
1542 | - //for (var i = 0; i <= $rootScope.sortedListArray.length - 1; i++) { | |
1543 | - | |
1544 | - // for (j = i + 1; j <= $rootScope.sortedListArray.length - 1; j++) { | |
1530 | + var temp = []; | |
1531 | + console.log($rootScope.duplicateListArray); | |
1532 | + for (var i = 0; i <= $rootScope.duplicateListArray.length - 1; i++) { | |
1533 | + var termID = $rootScope.duplicateListArray[i].id; | |
1534 | + if ($.inArray(termID, temp) == -1) { | |
1535 | + temp.push(termID); | |
1536 | + console.log('1'+$rootScope.duplicateListArray[i].title + " " + $rootScope.duplicateListArray[i].id); | |
1537 | + $rootScope.sortedListArray.push({ "title": $rootScope.duplicateListArray[i].title, "id": termID }); | |
1538 | + console.log('3' + $rootScope.sortedListArray[i].title + " " + $rootScope.sortedListArray[i].id) | |
1539 | + } | |
1540 | + } | |
1541 | + console.log('2'+$rootScope.sortedListArray); | |
1542 | + for (var i = 0; i <= $rootScope.sortedListArray.length - 1; i++) { | |
1543 | + | |
1544 | + for (j = i + 1; j <= $rootScope.sortedListArray.length - 1; j++) { | |
1545 | 1545 | |
1546 | - // if ($rootScope.sortedListArray[i].title.substr(0, 1) > $rootScope.sortedListArray[j].title.substr(0, 1)) { | |
1547 | - | |
1548 | - // var termText = $rootScope.sortedListArray[i].title; | |
1549 | - // var termNumbr = $rootScope.sortedListArray[i].termNumbr; | |
1550 | - // var termLanguage = $rootScope.sortedListArray[i].language; | |
1551 | - | |
1552 | - // $rootScope.sortedListArray[i].title = $rootScope.sortedListArray[j].title; | |
1553 | - // $rootScope.sortedListArray[i].termNumbr = $rootScope.sortedListArray[j].termNumbr; | |
1554 | - // $rootScope.sortedListArray[i].language = $rootScope.sortedListArray[j].language; | |
1555 | - | |
1556 | - // $rootScope.sortedListArray[j].title = termText; | |
1557 | - // $rootScope.sortedListArray[j].termNumbr = termNumbr; | |
1558 | - // $rootScope.sortedListArray[j].language = termLanguage; | |
1559 | - // } | |
1560 | - // } | |
1561 | - //} | |
1546 | + if ($rootScope.sortedListArray[i].title.substr(0, 1) > $rootScope.sortedListArray[j].title.substr(0, 1)) { | |
1547 | + | |
1548 | + var termText = $rootScope.sortedListArray[i].title; | |
1549 | + var termNumbr = $rootScope.sortedListArray[i].id; | |
1550 | + var termLanguage = $rootScope.sortedListArray[i].language; | |
1551 | + | |
1552 | + $rootScope.sortedListArray[i].title = $rootScope.sortedListArray[j].title; | |
1553 | + $rootScope.sortedListArray[i].id = $rootScope.sortedListArray[j].id; | |
1554 | + $rootScope.sortedListArray[i].language = $rootScope.sortedListArray[j].language; | |
1555 | + | |
1556 | + $rootScope.sortedListArray[j].title = termText; | |
1557 | + $rootScope.sortedListArray[j].id = termNumbr; | |
1558 | + $rootScope.sortedListArray[j].language = termLanguage; | |
1559 | + } | |
1560 | + } | |
1561 | + } | |
1562 | 1562 | |
1563 | 1563 | for (var j = 0; j <= $rootScope.sortedListArray.length - 1; j++) { |
1564 | 1564 | var $selectedOptions = $('<option title= "' + $rootScope.sortedListArray[j].title + '" id= "' + $rootScope.sortedListArray[j].id + '" >' + $rootScope.sortedListArray[j].title + '</option>').appendTo("#termList"); | ... | ... |