diff --git a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
index 44255f6..25fb840 100644
--- a/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
+++ b/400-SOURCECODE/AIAHTML5.Web/app/controllers/DAController.js
@@ -639,106 +639,97 @@ function ($scope, $rootScope, $compile, $http, $log, $location, $timeout, DA, Mo
})
// $rootScope.languageArray = [];
$rootScope.loadSearchDataForBodyView = function () {
- debugger;
+
var languageArray = [];
- $scope.vocabTermTxtArray = [];
+ $rootScope.vocabTermTxtArray = [];
var languageArray = $rootScope.lexiconLanguageArray;
+
+ console.log(languageArray.length);
console.log('loadSearchDataForBodyView');
var currentBodyViewId = localStorage.getItem("currentBodyViewId");
+ for (var i = 0; i <= languageArray.length - 1; i++) {
+ var searchWorker = new Worker('search-wp.js');
- var searchWorker = new Worker('search-wp.js');
-
- //push workers in array to further used the refernece to delete the workers
- $scope.runningSearchWorkers.push({ 'workerName': searchWorker })
-
- //console.log('for bodyRegionId = ' + bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"))
-
- searchWorker.postMessage({
- 'currentBodyViewId': currentBodyViewId,
- 'languageArray': languageArray
- })
-
- searchWorker.onmessage = function (e) {
- //console.log('callback searchWorker , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
+ //push workers in array to further used the refernece to delete the workers
+ $scope.runningSearchWorkers.push({ 'workerName': searchWorker })
+ //console.log('for bodyRegionId = ' + bodyRegionId + ', time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"))
- $rootScope.TermNumberData = e.data.TermNumberData,
- $rootScope.VocabTermData = e.data.VocabTermData,//same
- $scope.vocabTermTxt = e.data.vocabTermTxt,
- $scope.vocabTermTxtArray = e.data.DataArray,
- alert($rootScope.TermNumberData)
- //$scope.vocabLang = e.data.a
- alert($scope.vocabTermTxtArray[0].language);
- alert($scope.vocabTermTxtArray[0].VocabTermData);
- alert($scope.vocabTermTxtArray[0].vocabTermTxt);
-
- console.log("language" + $scope.vocabTermTxtArray[0].language);
- console.log("VocabTermData" + $scope.vocabTermTxtArray[0].VocabTermData);
- console.log("vocabTermTxt" + $scope.vocabTermTxtArray[0].vocabTermTxt);
-
-
- for (var i = 0; i <= $rootScope.lexiconLanguageArray.length - 1; i++) {
+ searchWorker.postMessage({
+ 'currentBodyViewId': currentBodyViewId,
+ 'languageName': languageArray[i].language,
+ 'languageID': languageArray[i].id
+ })
- $scope.vocabTermTxtArray[i].vocabTermTxt = new jinqJs()
- .from($scope.vocabTermTxtArray[i].vocabTermTxt)
- .distinct('_TermText', '_ActualTermNumber')
- .orderBy([{ field: '_TermText', sort: 'asc' }])
- .select('_ActualTermNumber', '_TermText', '_cdId');
+ searchWorker.onmessage = function (e) {
+ //console.log('callback searchWorker , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
+ $rootScope.TermNumberData = e.data.TermNumberData;
+ $rootScope.VocabTermData = e.data.VocabTermData,//same
+ $scope.vocabTermTxt = e.data.vocabTermTxt,
+ $scope.vocabLanguage = e.data.language,
+ $rootScope.vocabTermTxtArray.push({ "language": $scope.vocabLanguage, "VocabTermData": $rootScope.VocabTermData, "vocabTermTxt": $scope.vocabTermTxt });
+ for (var i = 0; i <= $rootScope.lexiconLanguageArray.length - 1; i++) {
+
- }
- alert("After" + $scope.vocabTermTxtArray.length);
- //$scope.VocabTermTxt = new jinqJs()
- // .from($scope.vocabTermTxt)
- // .distinct('_TermText', '_ActualTermNumber')
- // .orderBy([{ field: '_TermText', sort: 'asc' }])
- // .select('_ActualTermNumber', '_TermText', '_cdId');
+ $rootScope.vocabTermTxtArray[i].vocabTermTxt = new jinqJs()
+ .from($rootScope.vocabTermTxtArray[i].vocabTermTxt)
+ .distinct('_TermText', '_ActualTermNumber')
+ .orderBy([{ field: '_TermText', sort: 'asc' }])
+ .select('_ActualTermNumber', '_TermText', '_cdId');
+ // alert("After" + $rootScope.vocabTermTxtArray.length);
+ console.log("Language= " + $rootScope.lexiconLanguageArray[i].language + ", vocabTermTxt= " + $rootScope.vocabTermTxtArray[i].vocabTermTxt[0]._TermText);
+ }
+ // alert("After" + $rootScope.vocabTermTxtArray[0].vocabTermTxt);
+ //$scope.VocabTermTxt = new jinqJs()
+ // .from($scope.vocabTermTxt)
+ // .distinct('_TermText', '_ActualTermNumber')
+ // .orderBy([{ field: '_TermText', sort: 'asc' }])
+ // .select('_ActualTermNumber', '_TermText', '_cdId');
- //$rootScope.languageArray.push({ language: $scope.vocabLang, Text: $scope.VocabTermTxt });
- //alert($rootScope.languageArray.length);
- console.log('JlinqActivity , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
+ console.log('JlinqActivity , time: ' + new Date().toTimeString().replace(/.*(\d{2}:\d{2}:\d{2}).*/, "$1"));
- if ($scope.runningSearchWorkers != null || $scope.runningSearchWorkers != undefined) {
+ if ($scope.runningSearchWorkers != null || $scope.runningSearchWorkers != undefined) {
- var workerCount = $scope.runningSearchWorkers.length;
- if (workerCount > 0) {
- for (var i = workerCount - 1; i >= 0; i--) {
+ var workerCount = $scope.runningSearchWorkers.length;
+ if (workerCount > 0) {
+ for (var i = workerCount - 1; i >= 0; i--) {
- var runningWorker = $scope.runningSearchWorkers[i].workerName;
- runningWorker.terminate();
- $scope.runningSearchWorkers.splice(i, 1);
- // workerCount--;
+ var runningWorker = $scope.runningSearchWorkers[i].workerName;
+ runningWorker.terminate();
+ $scope.runningSearchWorkers.splice(i, 1);
+ // workerCount--;
+ }
}
}
}
- }
-
- //call watch on '$scope.VocabTermTxt and compile
and append to
on first time load
- $scope.$watch('$scope.VocabTermTxt', function (newValue, oldValue, scope) {
- //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()
- //Delay compile of ul li so that the remove of li is completed.
- $timeout(function () {
- var $e2 = $('
').appendTo('#searchListDiv')
- $compile($e2)($scope);
+ //call watch on '$scope.VocabTermTxt and compile
and append to
on first time load
+ $scope.$watch('$scope.VocabTermTxt', function (newValue, oldValue, scope) {
- }, 500);
+ //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()
+ //Delay compile of ul li so that the remove of li is completed.
+ $timeout(function () {
+ var $e2 = $('