2017-02-04 92 views
0

我已經應用了複選框過濾器使用功能數據被過濾,但加載後整個頁面數組內容不顯示,數據顯示只檢查1條件,如果用戶選中複選框,如何解決這個問題?複選框過濾器不適用於Angular JS?

/** 
 
    - @Copyright Notice: 
 
    - @(#) 
 
    - @Type: Controller 
 
    - @For: seller_dashboard_controller.js used for seller_dashboard.jsp page 
 
    - @Description: 
 
*/ 
 

 
bobApp.controller("buyerDashboardProfileController", ['$scope', 'BuyerDashboardService', function($scope, BuyerDashboardService) { 
 
\t 
 
\t /** 
 
\t * @Summary:getIntermediaryOnBuyerDashboard, to get the connected intermediary List. 
 
\t * @param: callback 
 
\t * @return: callback(response) . 
 
\t * @Description: 
 
\t */ 
 
\t $scope.connetedIntermediary = []; 
 
\t 
 
\t //Defining function for $scope.getConnectedIntermediary in service 
 
\t $scope.getConnectedIntermediary = function() { 
 
\t \t //used for get connected intermediary 
 
\t \t var data = { 
 
\t \t \t \t buyerUserTypeKeyId : Number(AUTH.userTypeKeyId), 
 
\t \t \t \t userTypeRel   : "buyer", 
 
\t \t \t \t reqFromUserType  : "buyer", 
 
\t \t \t \t reqToUserType  : "intermediary" 
 
\t \t }; 
 
\t \t BuyerDashboardService.getBuyerDashboard(function(response) { 
 
\t \t \t if(response != null) { 
 
\t \t \t \t if(response.data.isSuccess) { 
 
\t \t \t \t \t $scope.connetedIntermediary = response.data.userRelationDto; 
 
\t \t \t \t } 
 
\t \t \t } 
 
\t \t },data) 
 
\t }; 
 
\t $scope.getConnectedIntermediary(); 
 
\t 
 

 
\t /** 
 
\t * @Summary:connectedSeller, to get the connected connected SellerList. 
 
\t * @param: callback 
 
\t * @return: callback(response) . 
 
\t * @Description: 
 
\t */ 
 
\t $scope.connectedSeller = []; 
 
\t //Defining function for $scope connetedSeller in service 
 
\t $scope.getConnectedSeller = function() { 
 
\t \t //used for get connected seller 
 
\t \t var data = { 
 
\t \t \t \t buyerUserTypeKeyId : Number(AUTH.userTypeKeyId), 
 
\t \t \t \t userTypeRel   : "buyer", 
 
\t \t \t \t reqFromUserType  : "buyer", 
 
\t \t \t \t reqToUserType  : "seller" 
 
\t \t }; 
 
\t \t BuyerDashboardService.getBuyerDashboard(function(response) { 
 
\t \t \t if(response != null) { 
 
\t \t \t \t if(response.data.isSuccess) { 
 
\t \t \t \t \t $scope.connectedSeller = response.data.userRelationDto; 
 
\t \t \t \t } 
 
\t \t \t } 
 
\t \t },data) 
 
\t }; 
 
\t $scope.getConnectedSeller(); 
 
\t 
 
\t /** 
 
\t * @Summary:filterCityList, to get the filtered cityList. 
 
\t * @param: callback 
 
\t * @return: callback(response) . 
 
\t * @Description: 
 
\t */ 
 
\t 
 
\t $scope.filterCityList = []; 
 
\t //Defining function for includeCity for received the city after click on the checkbox 
 
\t $scope.includeCity = function(city) { 
 
\t \t var i = $.inArray(city, $scope.filterCityList); 
 
\t \t \t \t if (i > -1) { 
 
\t \t \t \t \t $scope.filterCityList.splice(i, 1); 
 
\t \t \t \t } else { 
 
\t \t \t \t \t $scope.filterCityList.push(city); 
 
\t \t \t } 
 
\t \t } 
 
\t \t 
 
\t //Defining cityFilter function for filter the city for the connectedSeller 
 
\t $scope.cityFilter = function(connectedSeller) { 
 
\t \t if ($scope.includeCity.length > 0) { 
 
\t \t \t if ($.inArray(connectedSeller.city, $scope.filterCityList) < 0) 
 
\t \t \t \t return; 
 
\t \t \t } 
 
\t \t return connectedSeller; 
 
\t } 
 
\t } 
 
]);
<div id="seller" class="userTab" style="display:none"> 
 
\t \t \t <div class="w3-col m7 l9"> 
 
\t \t \t \t <div class="w3-container w3-card-2 w3-white w3-hover-light-grey" 
 
\t \t \t \t \t ng-repeat="seller in connectedSeller.sellerDtos | filter:cityFilter" 
 
\t \t \t \t \t style="margin:0 0px 0px 0px; padding:0px;"> 
 
\t \t \t \t \t <img src="{{seller.userTypeDto.imageURL !=null ? seller.userTypeDto.imageURL : '/static/assets/img/image_placeholder.jpg'}}" 
 
\t \t \t \t \t \t class="w3-border w3-padding w3-margin-right pull-left userImg"> 
 
\t \t \t \t \t <div class=""> 
 
\t \t \t \t \t \t <h5 class="w3-opacity w3-padding-top"> 
 
\t \t \t \t \t \t \t <b>{{seller.firmName}}</b> 
 
\t \t \t \t \t \t </h5> 
 
\t \t \t \t \t \t <h6 class="w3-text-teal"> 
 
\t \t \t \t \t \t \t <i class="fa fa-user fa-fw"></i> 
 
\t \t \t \t \t \t \t {{seller.personName}} 
 
\t \t \t \t \t \t \t <span class="w3-tag w3-teal w3-round w3-small"> 
 
\t \t \t \t \t \t \t \t {{seller.userTypeDto.userType}} 
 
\t \t \t \t \t \t \t </span> 
 
\t \t \t \t \t \t </h6> 
 
\t \t \t \t \t \t <p> 
 
\t \t \t \t \t \t \t <span ng-if="seller.userTypeDto.email"> 
 
\t \t \t \t \t \t \t \t Email - {{seller.userTypeDto.email}} | 
 
\t \t \t \t \t \t \t </span> 
 
\t \t \t \t \t \t \t <span ng-if="seller.userTypeDto.phoneNumber"> 
 
\t \t \t \t \t \t \t \t Contact Number - {{seller.userTypeDto.phoneNumber}} | 
 
\t \t \t \t \t \t \t </span> 
 
\t \t \t \t \t \t \t <span ng-if="seller.city"> 
 
\t \t \t \t \t \t \t \t City - {{seller.city}} | 
 
\t \t \t \t \t \t \t </span> 
 
\t \t \t \t \t \t \t <span ng-if="seller.state"> 
 
\t \t \t \t \t \t \t \t State- {{seller.state}} 
 
\t \t \t \t \t \t \t </span> 
 
\t \t \t \t \t \t </p> 
 
\t \t \t \t \t </div> 
 
\t \t \t \t </div> 
 
\t \t \t </div> 
 
\t \t </div>

回答

-1

/** 
 
    - @Copyright Notice: 
 
    - @(#) 
 
    - @Type: Controller 
 
    - @For: seller_dashboard_controller.js used for seller_dashboard.jsp page 
 
    - @Description: 
 
*/ 
 

 
bobApp.controller("buyerDashboardProfileController", ['$scope', 'BuyerDashboardService', function($scope, BuyerDashboardService) { 
 
\t 
 
\t /** 
 
\t * @Summary:getIntermediaryOnBuyerDashboard, to get the connected intermediary List. 
 
\t * @param: callback 
 
\t * @return: callback(response) . 
 
\t * @Description: 
 
\t */ 
 
\t $scope.connetedIntermediary = []; 
 
\t 
 
\t //Defining function for $scope.getConnectedIntermediary in service 
 
\t $scope.getConnectedIntermediary = function() { 
 
\t \t //used for get connected intermediary 
 
\t \t var data = { 
 
\t \t \t \t buyerUserTypeKeyId : Number(AUTH.userTypeKeyId), 
 
\t \t \t \t userTypeRel   : "buyer", 
 
\t \t \t \t reqFromUserType  : "buyer", 
 
\t \t \t \t reqToUserType  : "intermediary" 
 
\t \t }; 
 
\t \t BuyerDashboardService.getBuyerDashboard(function(response) { 
 
\t \t \t if(response != null) { 
 
\t \t \t \t if(response.data.isSuccess) { 
 
\t \t \t \t \t $scope.connetedIntermediary = response.data.userRelationDto; 
 
\t \t \t \t } 
 
\t \t \t } 
 
\t \t },data) 
 
\t }; 
 
\t $scope.getConnectedIntermediary(); 
 
\t 
 

 
\t /** 
 
\t * @Summary:connectedSeller, to get the connected connected SellerList. 
 
\t * @param: callback 
 
\t * @return: callback(response) . 
 
\t * @Description: 
 
\t */ 
 
\t $scope.connectedSeller = []; 
 
\t //Defining function for $scope connetedSeller in service 
 
\t $scope.getConnectedSeller = function() { 
 
\t \t //used for get connected seller 
 
\t \t var data = { 
 
\t \t \t \t buyerUserTypeKeyId : Number(AUTH.userTypeKeyId), 
 
\t \t \t \t userTypeRel   : "buyer", 
 
\t \t \t \t reqFromUserType  : "buyer", 
 
\t \t \t \t reqToUserType  : "seller" 
 
\t \t }; 
 
\t \t BuyerDashboardService.getBuyerDashboard(function(response) { 
 
\t \t \t if(response != null) { 
 
\t \t \t \t if(response.data.isSuccess) { 
 
\t \t \t \t \t $scope.connectedSeller = response.data.userRelationDto; 
 
\t \t \t \t } 
 
\t \t \t } 
 
\t \t },data) 
 
\t }; 
 
\t $scope.getConnectedSeller(); 
 
\t 
 
\t /** 
 
\t * @Summary:filterCityList, to get the filtered cityList. 
 
\t * @param: callback 
 
\t * @return: callback(response) . 
 
\t * @Description: 
 
\t */ 
 
\t 
 
\t $scope.filterCityList = []; 
 
\t //Defining function for includeCity for received the city after click on the checkbox 
 
\t $scope.includeCity = function(city) { 
 
\t \t var i = $.inArray(city, $scope.filterCityList); 
 
\t \t \t \t if (i > -1) { 
 
\t \t \t \t \t $scope.filterCityList.splice(i, 1); 
 
\t \t \t \t } else { 
 
\t \t \t \t \t $scope.filterCityList.push(city); 
 
\t \t \t } 
 
\t \t } 
 
\t \t 
 
\t //Defining cityFilter function for filter the city for the connectedSeller 
 
\t $scope.cityFilter = function(connectedSeller) { 
 
\t \t if ($scope.includeCity.length > 0) { 
 
\t \t \t if ($.inArray(connectedSeller.city, $scope.filterCityList) < 0) 
 
\t \t \t \t return; 
 
\t \t \t } 
 
\t \t return connectedSeller; 
 
\t } 
 
\t } 
 
]);
<div id="seller" class="userTab" style="display:none"> 
 
\t \t \t <div class="w3-col m7 l9"> 
 
\t \t \t \t <div class="w3-container w3-card-2 w3-white w3-hover-light-grey" 
 
\t \t \t \t \t ng-repeat="seller in connectedSeller.sellerDtos | filter:cityFilter" 
 
\t \t \t \t \t style="margin:0 0px 0px 0px; padding:0px;"> 
 
\t \t \t \t \t <img src="{{seller.userTypeDto.imageURL !=null ? seller.userTypeDto.imageURL : '/static/assets/img/image_placeholder.jpg'}}" 
 
\t \t \t \t \t \t class="w3-border w3-padding w3-margin-right pull-left userImg"> 
 
\t \t \t \t \t <div class=""> 
 
\t \t \t \t \t \t <h5 class="w3-opacity w3-padding-top"> 
 
\t \t \t \t \t \t \t <b>{{seller.firmName}}</b> 
 
\t \t \t \t \t \t </h5> 
 
\t \t \t \t \t \t <h6 class="w3-text-teal"> 
 
\t \t \t \t \t \t \t <i class="fa fa-user fa-fw"></i> 
 
\t \t \t \t \t \t \t {{seller.personName}} 
 
\t \t \t \t \t \t \t <span class="w3-tag w3-teal w3-round w3-small"> 
 
\t \t \t \t \t \t \t \t {{seller.userTypeDto.userType}} 
 
\t \t \t \t \t \t \t </span> 
 
\t \t \t \t \t \t </h6> 
 
\t \t \t \t \t \t <p> 
 
\t \t \t \t \t \t \t <span ng-if="seller.userTypeDto.email"> 
 
\t \t \t \t \t \t \t \t Email - {{seller.userTypeDto.email}} | 
 
\t \t \t \t \t \t \t </span> 
 
\t \t \t \t \t \t \t <span ng-if="seller.userTypeDto.phoneNumber"> 
 
\t \t \t \t \t \t \t \t Contact Number - {{seller.userTypeDto.phoneNumber}} | 
 
\t \t \t \t \t \t \t </span> 
 
\t \t \t \t \t \t \t <span ng-if="seller.city"> 
 
\t \t \t \t \t \t \t \t City - {{seller.city}} | 
 
\t \t \t \t \t \t \t </span> 
 
\t \t \t \t \t \t \t <span ng-if="seller.state"> 
 
\t \t \t \t \t \t \t \t State- {{seller.state}} 
 
\t \t \t \t \t \t \t </span> 
 
\t \t \t \t \t \t </p> 
 
\t \t \t \t \t </div> 
 
\t \t \t \t </div> 
 
\t \t \t </div> 
 
\t \t </div>

+0

sir..what是在此代碼不同 – Kapil707