1
我創建了一個使用AngularJS和引導程序的多選擇下拉菜單,並添加了搜索和滾動選項,它工作正常。 我需要在多選下拉滾動條中滾動時實現無限滾動。它不適用於多選擇下拉菜單,但無限滾動工作爲div。 我看到onItemSelect的事件,onItemDeselect沒有找到任何滾動多選擇下拉的事件。angularJS ng-dropdown-multiselect實現無限滾動的滾動事件
我包括下面的代碼:
<div ng-dropdown-multiselect="" options="user" selected-model="userModel" extra-settings="example14settings" when-scrolled="loadMore()"></div>
$scope.example14settings = {
scrollableHeight: '100px',
scrollable: true,
enableSearch: true
};
$http.get('user').success(function(response){
//users list has huge data need to implemented infinite scroll
$scope.userList = response;
$scope.users = $scope.userList.slice(0,10);
});
$scope.loadMore = function(){
$scope.user = $scope.users.slice(0, $scope.user.length + 8);
};
外部DIV內部沒有mutlselect下拉列表下面正在無限滾動代碼同時搜尋後,沒有做無限滾動的下一個數據集。
代碼:
<div id="fixed" ng-dropdown-multiselect="" options="user"
selected-model="userModel"
extra-settings="example14settings" when-scrolled="loadMore()"></div>
#fixed {
height: 400px;
overflow : auto;
}
$scope.example14settings = {
enableSearch: true
};
angular.module('App').directive('whenScrolled', function() {
return function(scope, elm, attr) {
var raw = elm[0];
elm.bind('scroll', function() {
if (raw.scrollTop + raw.offsetHeight >= raw.scrollHeight) {
scope.$apply(attr.whenScrolled);
}
});
};
});
如何我裏面添加滾動的角度多選下拉無限滾動? 也當用戶搜索的東西無限滾動時應該在搜索數據滾動時向下工作?
謝謝你的回覆。我在html中添加了when-scrolled =「loadMore()」,並且在向下滾動時調用loadMore()。無限滾動在div中工作時,我需要將它應用於ng-dropdown-多選可滾動條。 – neha
你的問題是你在「div」而不是在「select」上調用指令。你的選擇是一個屬性而不是一個元素。 –
你知道如何在袖子上打電話嗎?我正在使用ng-dropdown-multiselect和下面的設置?是否有像滾動選擇事件一樣的滾動事件? $ scope.example14settings = { scrollableHeight:'100px', scrollable:true, enableSearch:true }; – neha