Commit e5997e04f660f10acfe886e89dc5ff092e61e6ff

Authored by unknown
1 parent 85c71e46

Issue in search list

400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
... ... @@ -667,7 +667,7 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
667 667 })
668 668 // $rootScope.languageArray = [];
669 669 $rootScope.loadSearchData = function () {
670   -
  670 + var primaryLexiconIndex;
671 671 var languageArray = [];
672 672 $rootScope.vocabTermDataArray = [];
673 673 var languageArray = $rootScope.lexiconLanguageArray;
... ... @@ -719,14 +719,13 @@ AIA.controller("DAController", ["$scope", "$rootScope", "$compile", "$http", "$l
719 719  
720 720 if ($rootScope.vocabTermDataArray.length == $rootScope.lexiconLanguageArray.length) {
721 721 $("#setting-spinner").css("display", "none");
722   - // $rootScope.isLoading = false;
723   - // $("#spinner").css("visibility", "hidden");
724   - // // $("#spinner").css("display", "none");
725   -
726   - //} else {
727   - // $rootScope.isLoading = true;
728   - // $("#spinner").css("visibility", "visible");
729   - // // $("#spinner").css("visibility", "block");
  722 +
  723 + for (var i = 0; i <= $rootScope.vocabTermDataArray.length - 1; i++) {
  724 + if ($rootScope.vocabTermDataArray[i].language == $rootScope.lexiconLanguageArray[0].language) {
  725 + primaryLexiconIndex = i;
  726 + }
  727 + }
  728 + //alert(primaryLexiconIndex);
730 729 if ($rootScope.isListManagerMenuSelected) {
731 730 $scope.loadListManger();
732 731 }
... ... @@ -748,55 +747,16 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
748 747 }
749 748 }
750 749 }
751   -
752   -
753   -
754   -
755   -
756 750 }
757 751  
  752 +
  753 + //console.log("s" + $rootScope.vocabTermDataArray);
758 754 //call watch on '$scope.VocabTermTxt and compile <li> and append to <ul> on first time load
759   - $scope.$watch('$rootScope.vocabTermDataArray[0].vocabTermTxt', function (newValue, oldValue, scope) {
760   -
761   - //This is added as the $scope.VocabTermTxt can change while changing view also the li elements need to be removed
762   - //Remove the list and then Repopulate
763   - if ($('#searchListDiv').html() != "")
764   - $('#searchListDiv').empty()
765   - //Delay compile of ul li so that the remove of li is completed.
766   - $timeout(function () {
767   - var $e2 = $('<ul id="termlistfilter" class="form-control dropdown-menu" style="height:90px;width:100%;overflow-y:scroll;position:absolute;display:none;z-index:60001;"><li ng-repeat="item in vocabTermDataArray[0].vocabTermTxt| filter:{ _TermText: searchFilter}">' +
768   - '<a id="{{item._ActualTermNumber}}" href="" onclick="selectTerm(event)">{{item._TermText}}</a>' +
769   - ' </li></ul>').appendTo('#searchListDiv')
770   - $compile($e2)($scope);
771   -
772   - $rootScope.isSearchInputClicked = true;
773   -
774   - console.log("INSIDE WATCH. LIST IS CREATED");
775   - $scope.isSearchDataLoaded = true;
776   -
777   - if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) {
778   -
779   - if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) {
780   - $rootScope.isLoading = false;
781   - $('#spinner').css('visibility', 'hidden');
782   - }
783   - else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) {
784   - $rootScope.isLoading = false;
785   - $('#spinner').css('visibility', 'hidden');
786   - }
787   - else if (($rootScope.viewOrientationId == '5') && ($scope.ColoredImageSRC.length == 4)) {
788   - $rootScope.isLoading = false;
789   - $('#spinner').css('visibility', 'hidden');
790   - }
791   - else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) {
792   - $rootScope.isLoading = false;
793   - $('#spinner').css('visibility', 'hidden');
794   - }
795   - }
796   -
797   - }, 500);
  755 + //$scope.$watch('$rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt', function (newValue, oldValue, scope) {
  756 +
  757 +
798 758  
799   - }, true);
  759 + //}, true);
800 760  
801 761 }
802 762  
... ... @@ -8417,20 +8377,71 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
8417 8377  
8418 8378  
8419 8379 $scope.ShowSearch = function () {
  8380 +
  8381 + var primaryLexiconIndex;
  8382 + for (var i = 0; i <= $rootScope.vocabTermDataArray.length - 1; i++) {
  8383 + if ($rootScope.vocabTermDataArray[i].language == $rootScope.lexiconLanguageArray[0].language) {
  8384 + primaryLexiconIndex = i;
  8385 + }
  8386 + }
8420 8387 console.log('ShowSearch is called');
8421 8388 //this check is for log only because we are writing length so need to check if its not null or undefined
8422   - if ($rootScope.vocabTermDataArray[0].vocabTermTxt != null || $rootScope.vocabTermDataArray[0].vocabTermTxt != undefined)
8423   - console.log('$scope.VocabTermTxt.length= ' + $rootScope.vocabTermDataArray[0].vocabTermTxt.length)
  8389 + if ($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != undefined)
  8390 + console.log('$scope.VocabTermTxt.length= ' + $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt.length)
8424 8391  
8425 8392 $timeout(function () {
8426   - if (($rootScope.vocabTermDataArray[0].vocabTermTxt != null || $rootScope.vocabTermDataArray[0].vocabTermTxt != undefined) && ($rootScope.vocabTermDataArray[0].vocabTermTxt.length > 0)) {
  8393 +
  8394 + if (($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != null || $rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt != undefined) && ($rootScope.vocabTermDataArray[0].vocabTermTxt.length > 0)) {
  8395 + //This is added as the $scope.VocabTermTxt can change while changing view also the li elements need to be removed
  8396 + //Remove the list and then Repopulate
  8397 + if ($('#searchListDiv').html() != "")
  8398 + $('#searchListDiv').empty()
  8399 + //Delay compile of ul li so that the remove of li is completed.
  8400 + $timeout(function () {
  8401 + //var $e2 = $('<ul id="termlistfilter" class="form-control dropdown-menu" style="height:90px;width:100%;overflow-y:scroll;position:absolute;display:none;z-index:60001;"><li ng-repeat="item in vocabTermDataArray[0].vocabTermTxt| filter:{ _TermText: searchFilter}">' +
  8402 + // '<a id="{{item._ActualTermNumber}}" href="" onclick="selectTerm(event)">{{item._TermText}}</a>' +
  8403 + // ' </li></ul>').appendTo('#searchListDiv')
  8404 + //$compile($e2)($scope);
  8405 +
  8406 + $rootScope.isSearchInputClicked = true;
8427 8407  
  8408 + console.log("INSIDE WATCH. LIST IS CREATED");
  8409 + $scope.isSearchDataLoaded = true;
  8410 +
  8411 + if (($scope.ColoredImageSRC != null || $scope.ColoredImageSRC != undefined)) {
  8412 +
  8413 + if ((($rootScope.viewOrientationId == '1') || ($rootScope.viewOrientationId == '4')) && ($scope.ColoredImageSRC.length == 9)) {
  8414 + $rootScope.isLoading = false;
  8415 + $('#spinner').css('visibility', 'hidden');
  8416 + }
  8417 + else if ((($rootScope.viewOrientationId == '2') || ($rootScope.viewOrientationId == '3')) && ($scope.ColoredImageSRC.length == 5)) {
  8418 + $rootScope.isLoading = false;
  8419 + $('#spinner').css('visibility', 'hidden');
  8420 + }
  8421 + else if (($rootScope.viewOrientationId == '5') && ($scope.ColoredImageSRC.length == 4)) {
  8422 + $rootScope.isLoading = false;
  8423 + $('#spinner').css('visibility', 'hidden');
  8424 + }
  8425 + else if (($rootScope.viewOrientationId == '6') && ($scope.ColoredImageSRC.length == 1)) {
  8426 + $rootScope.isLoading = false;
  8427 + $('#spinner').css('visibility', 'hidden');
  8428 + }
  8429 + }
  8430 +
  8431 + }, 500);
8428 8432 $scope.IsSearchVisible = true;
  8433 + console.log("s" + $rootScope.vocabTermDataArray[primaryLexiconIndex].language);
  8434 + $rootScope.a = primaryLexiconIndex;
  8435 + var $e2 = $('<ul id="termlistfilter" class="form-control dropdown-menu" style="height:90px;width:100%;overflow-y:scroll;position:absolute;display:none;z-index:60001;"><li ng-repeat="item in vocabTermDataArray[a].vocabTermTxt| filter:{ _TermText: searchFilter}">' +
  8436 + '<a id="{{item._ActualTermNumber}}" href="" onclick="selectTerm(event)">{{item._TermText}}</a>' +
  8437 + ' </li></ul>').appendTo('#searchListDiv')
  8438 + $compile($e2)($scope);
  8439 +
8429 8440 document.getElementById("termlistfilter").style.display = "block";
8430 8441 }
8431 8442 else {
8432 8443 $rootScope.loadSearchData();
8433   - if ($rootScope.vocabTermDataArray[0].vocabTermTxt.length > 0) {
  8444 + if ($rootScope.vocabTermDataArray[primaryLexiconIndex].vocabTermTxt.length > 0) {
8434 8445 $scope.ShowSearch();
8435 8446 }
8436 8447 }
... ... @@ -8583,14 +8594,20 @@ AIA.controller(&quot;DAController&quot;, [&quot;$scope&quot;, &quot;$rootScope&quot;, &quot;$compile&quot;, &quot;$http&quot;, &quot;$l
8583 8594 });
8584 8595  
8585 8596 $scope.loadListManger = function () {
8586   -
  8597 + var primaryLexiconIndex;
  8598 + for (var i = 0; i <= $rootScope.vocabTermDataArray.length - 1; i++) {
  8599 + if ($rootScope.vocabTermDataArray[i].language == $rootScope.lexiconLanguageArray[0].language) {
  8600 + primaryLexiconIndex = i;
  8601 + }
  8602 + }
  8603 + console.log($rootScope.vocabTermDataArray[primaryLexiconIndex].language);
8587 8604 $rootScope.isListManagerMenuSelected = true;
8588 8605  
8589 8606 var vocabTermTxt = [];
8590 8607 if ($rootScope.TermNumberData != null || $rootScope.TermNumberData != undefined && $rootScope.TermNumberData.length > 0) {
8591 8608 angular.forEach($rootScope.TermNumberData.TermData.Term, function (value1, key1) {
8592 8609  
8593   - angular.forEach($rootScope.vocabTermDataArray[0].VocabTermData.VocabTerms.Term, function (value2, key2) {
  8610 + angular.forEach($rootScope.vocabTermDataArray[primaryLexiconIndex].VocabTermData.VocabTerms.Term, function (value2, key2) {
8594 8611  
8595 8612  
8596 8613 if (value1._ActualTermNumber === value2._ActualTermNumber) {
... ...