diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js index 17df8e9..04cce01 100644 --- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js +++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js @@ -56,6 +56,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.isEligibleForHighlight = false; $scope.doHighlightOrExtract = false; $scope.isClickedOnBodyForHighlight; + $scope.isSearchClicked = false; $scope.isEligibleForHighlightBodyByTermList = false; // $scope.AnteriorView = "active"; @@ -816,7 +817,8 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l }) // $rootScope.languageArray = []; $rootScope.loadSearchData = function () { - var primaryLexiconIndex; + + $scope.primaryLexiconInd; var languageArray = []; $rootScope.vocabTermDataArray = []; var languageArray = $rootScope.lexiconLanguageArray; @@ -871,13 +873,16 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l for (var i = 0; i <= $rootScope.vocabTermDataArray.length - 1; i++) { if ($rootScope.vocabTermDataArray[i].language == $rootScope.lexiconLanguageArray[0].language) { - primaryLexiconIndex = i; + $scope.primaryLexiconInd = i; } } //alert(primaryLexiconIndex); - if ($rootScope.isListManagerMenuSelected) { + if ($rootScope.isListManagerMenuSelected ) { $scope.loadListManger(); } + else if ($scope.isSearchClicked) { + $scope.ShowSearch(); + } } @@ -8898,28 +8903,25 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l $scope.ShowSearch = function () { - if (($rootScope.vocabTermDataArray != null || $rootScope.vocabTermDataArray != undefined) && ($rootScope.vocabTermDataArray.length > 0)) { - var primaryLexiconIndex; - for (var i = 0; i <= $rootScope.vocabTermDataArray.length - 1; i++) { - if ($rootScope.vocabTermDataArray[i].language == $rootScope.lexiconLanguageArray[0].language) { - primaryLexiconIndex = i; - } - } - console.log('ShowSearch is called'); + + $scope.isSearchClicked = true; + console.log('ShowSearch is called'); + var primaryLexiconIndx = $scope.primaryLexiconInd; + //this check is for log only because we are writing length so need to check if its not null or undefined - if ($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != undefined) - console.log('$scope.VocabTermTxt.length= ' + $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt.length) + if ($rootScope.vocabTermDataArray[primaryLexiconIndx].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndx].vocabTermTxt != undefined) + console.log('$scope.VocabTermTxt.length= ' + $rootScope.vocabTermDataArray[primaryLexiconIndx].vocabTermTxt.length) $timeout(function () { - if (($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != undefined) && ($rootScope.vocabTermDataArray[0].vocabTermTxt.length > 0)) { + if (($rootScope.vocabTermDataArray[primaryLexiconIndx].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndx].vocabTermTxt != undefined) && ($rootScope.vocabTermDataArray[0].vocabTermTxt.length > 0)) { //This is added as the $scope.VocabTermTxt can change while changing view also the li elements need to be removed //Remove the list and then Repopulate if ($('#searchListDiv').html() != "") - $('#searchListDiv').empty() + $('#searchListDiv').empty(); //Delay compile of ul li so that the remove of li is completed. $timeout(function () { - console.log("INSIDE WATCH. LIST IS CREATED"); + $scope.isSearchDataLoaded = true; if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) { @@ -8944,12 +8946,17 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l }, 500); $scope.IsSearchVisible = true; - console.log("s" + $rootScope.vocabTermDataArray[primaryLexiconIndex].language); - $rootScope.a = primaryLexiconIndex; + console.log("primary language: " + $rootScope.vocabTermDataArray[primaryLexiconIndx].language); + + + $rootScope.a = primaryLexiconIndx; var $e2 = $('').appendTo('#searchListDiv') $compile($e2)($scope); + + console.log('termlistfilter is created and complied'); + document.getElementById("termlistfilter").style.display = "block"; $timeout(function () { $("#backdrop > #searchListDiv > #termlistfilter > li").each(function (key, value) { @@ -8969,19 +8976,15 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l } else { $rootScope.loadSearchData(); - if ($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt.length > 0) { - $scope.ShowSearch(); - } + //if ($rootScope.vocabTermDataArray[primaryLexiconIndx].vocabTermTxt.length > 0) { + // $scope.ShowSearch(); + //} } }, 500); - } - else { - $rootScope.loadSearchData(); - $scope.ShowSearch(); - - - } + + + } @@ -9119,7 +9122,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l }); $scope.loadListManger = function () { - var primaryLexiconIndex; + var primaryLexiconIndex = $scope.primaryLexiconInd;; if ($rootScope.vocabTermDataArray != null && $rootScope.vocabTermDataArray != undefined && $rootScope.vocabTermDataArray.length > 0) { for (var i = 0; i <= $rootScope.vocabTermDataArray.length - 1; i++) {