Commit 9c31c6db0c570dbcceb6e320103fc3a23ee57489
1 parent
0585407e
remove commented code and fixed for
Showing
2 changed files
with
20 additions
and
19 deletions
400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... | ... | @@ -8920,7 +8920,6 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$filter","$ |
8920 | 8920 | if ($('#searchListDiv').html() != "") |
8921 | 8921 | $('#searchListDiv').empty(); |
8922 | 8922 | //Delay compile of ul li so that the remove of li is completed. |
8923 | - $timeout(function () { | |
8924 | 8923 | |
8925 | 8924 | $scope.isSearchDataLoaded = true; |
8926 | 8925 | |
... | ... | @@ -8944,13 +8943,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$filter","$ |
8944 | 8943 | } |
8945 | 8944 | } |
8946 | 8945 | |
8947 | - }, 500); | |
8946 | + | |
8948 | 8947 | $scope.IsSearchVisible = true; |
8949 | 8948 | console.log("primary language: " + $rootScope.vocabTermDataArray[primaryLexiconIndx].language); |
8950 | 8949 | |
8951 | 8950 | |
8952 | 8951 | $rootScope.a = primaryLexiconIndx; |
8953 | - var $e2 = $('<ul id="termlistfilter" class="form-control dropdown-menu" style="height:130px;width:100%;overflow-y:scroll;position:absolute;display:none;z-index:60001;"><li ng-repeat="item in vocabTermDataArray[a].vocabTermTxt| filter:{ _TermText: searchFilter}">' + | |
8952 | + var $e2 = $('<ul id="termlistfilter" class="form-control dropdown-menu" style="height:130px;width:100%;overflow-y:scroll;position:absolute;display:none;z-index:60001;"><li ng-repeat="item in vocabTermDataArray[a].vocabTermTxt| filter:{ _TermText: searchFilter} | limitTo : 10">' + | |
8954 | 8953 | '<a id="{{item._ActualTermNumber}}" href="" onclick="selectTerm(event)">{{item._TermText}}</a>' + |
8955 | 8954 | ' </li></ul>').appendTo('#searchListDiv') |
8956 | 8955 | $compile($e2)($scope); |
... | ... | @@ -8958,27 +8957,22 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$filter","$ |
8958 | 8957 | console.log('termlistfilter is created and complied'); |
8959 | 8958 | |
8960 | 8959 | document.getElementById("termlistfilter").style.display = "block"; |
8961 | - $timeout(function () { | |
8960 | + | |
8962 | 8961 | $("#backdrop > #searchListDiv > #termlistfilter > li").each(function (key, value) { |
8963 | 8962 | if ($(this).find("a").html() == document.getElementById("typedTermName").value) { |
8964 | 8963 | $("#termlistfilter li a").css({ "background-color": "#ffffff", "color": "#000000" }); |
8965 | 8964 | $(this).find("a").css({ "background-color": "#3399FF", "color": "#ffffff" }); |
8966 | 8965 | } |
8967 | 8966 | }); |
8968 | - }, 100); | |
8969 | - $timeout(function () { | |
8970 | 8967 | $rootScope.searchListArray = []; |
8971 | 8968 | $("#backdrop > #searchListDiv > #termlistfilter > li").each(function (key, value) { |
8972 | 8969 | $rootScope.searchListArray.push({ "name": $(this).find("a").html(), "id": $(this).find("a").attr("id") }); |
8973 | 8970 | }); |
8974 | - }, 100); | |
8971 | + | |
8975 | 8972 | |
8976 | 8973 | } |
8977 | 8974 | else { |
8978 | 8975 | $rootScope.loadSearchData(); |
8979 | - //if ($rootScope.vocabTermDataArray[primaryLexiconIndx].vocabTermTxt.length > 0) { | |
8980 | - // $scope.ShowSearch(); | |
8981 | - //} | |
8982 | 8976 | } |
8983 | 8977 | }, 500); |
8984 | 8978 | |
... | ... | @@ -9809,13 +9803,15 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$filter","$ |
9809 | 9803 | if ($('#searchListDiv').html() != "") { |
9810 | 9804 | $('#searchListDiv').empty(); |
9811 | 9805 | } |
9806 | + //Bug 39757 | |
9807 | + $timeout(function () { | |
9812 | 9808 | $rootScope.a = $scope.primaryLexiconInd; |
9813 | 9809 | var $e2 = $('<ul id="termlistfilter" class="form-control dropdown-menu ng-scope" style="height:132px;width:100%;overflow-y:scroll;position:absolute;display:block;z-index:60001;"><li class="ng-scope" ng-repeat="item in vocabTermDataArray[a].vocabTermTxt| startsWithLetter:{ _TermText: searchFilter}| limitTo : 10">' + |
9814 | 9810 | '<a id="{{item._ActualTermNumber}}" href="" onclick="selectTerm(event)">{{item._TermText}}</a>' + |
9815 | 9811 | ' </li></ul>').appendTo('#searchListDiv') |
9816 | 9812 | $compile($e2)($scope); |
9817 | 9813 | document.getElementById("termlistfilter").style.display = "block"; |
9818 | - $timeout(function () { | |
9814 | + | |
9819 | 9815 | $("#backdrop > #searchListDiv > #termlistfilter > li").each(function (key, value) { |
9820 | 9816 | if ($(this).find("a").html() == document.getElementById("typedTermName").value) { |
9821 | 9817 | $("#termlistfilter li a").css({ "background-color": "#ffffff", "color": "#000000" }); |
... | ... | @@ -9909,7 +9905,8 @@ function enableShowHideStructureBox() { |
9909 | 9905 | function OnSearch() { |
9910 | 9906 | console.log('Show Search is called outside '); |
9911 | 9907 | var scope = angular.element(document.getElementById("daView")).scope(); |
9912 | - scope.$apply(function () { | |
9908 | + //Bug 39757 | |
9909 | + scope.$evalAsync(function () { | |
9913 | 9910 | scope.ShowSearch(); |
9914 | 9911 | }); |
9915 | 9912 | } | ... | ... |
400-SOURCECODE/AIAHTML5.Web/app/filters/AIAFilter.js
... | ... | @@ -2,15 +2,19 @@ |
2 | 2 | return function (items, letter) { |
3 | 3 | |
4 | 4 | var filtered = []; |
5 | - var letterMatch = new RegExp("^" + letter._TermText, 'i'); | |
6 | - for (var i = 0; i < items.length; i++) { | |
7 | - var item = items[i]; | |
8 | - //if (letterMatch.test(item._TermText.substring(0, 1))) { | |
9 | - if (letterMatch.test(item._TermText)) { | |
5 | + var letterMatch = new RegExp("^" + letter._TermText, 'i'); | |
6 | + for (var i = 0; i < items.length; i++) { | |
7 | + var item = items[i]; | |
8 | + //Bug 39757 | |
9 | + if (letterMatch.test(item._TermText)) { | |
10 | 10 | |
11 | - filtered.push(item); | |
11 | + filtered.push(item); | |
12 | + } | |
13 | + //Bug 39757 | |
14 | + if (filtered.length > 10) { | |
15 | + break; | |
16 | + } | |
12 | 17 | } |
13 | - } | |
14 | 18 | return filtered; |
15 | 19 | }; |
16 | 20 | }); |
17 | 21 | \ No newline at end of file | ... | ... |