滚动下5张

时间:2020-06-18 11:42:57

标签: javascript html angularjs qliksense

在我的求职过程中,我正在渲染qliksense卡。

  • )放在一边,我那里有100多张卡片。为了提高性能,我第一次只需要加载5张卡。滚动到底部时,我需要加载下5张卡。

  • )这样,每次滚动到达结束后,我需要每次5张卡中加载5张卡。

我尝试过的正常angularjs函数。但是qliksense卡并没有重新发布。

请看下面的代码,

myHtml.html:

<div class="left-pane" infinite-scroll="myPagingFunction()" infinite-scroll-distance="3" directive-when-scrolled="loadMore()">
   <aside ng-class="{'type-two': getTabLength.length <= 2}" class="aside-elem" info-pop-up="cards" screen-percent="25">
   <div class="qlikrender" ng-repeat="card in cards | limitTo: limit" >
   {{card.objectid}}
</div>
</aside>
</div>

myDirective.js:

app.directive("directiveWhenScrolled", function() {
        return function(scope, elm, attr) {
            var raw = elm[0];

            elm.bind('scroll', function() {
                if (raw.scrollTop + raw.offsetHeight >= raw.scrollHeight) {
                    scope.$apply(attr.directiveWhenScrolled);
                }
            });
        };
    });

myController.js:

      //$scope.cards  - This is having all 100 cards

       $scope.loadMore = function() {
       var lastIndex = $scope.cards.length - 1;
       for (var j = 1; j <= 5; j++) {
         $scope.cards.push($scope.cards[lastIndex + j]);
       }
                
       $scope.cards.forEach(function(card) {
         app.getObject(card.objectid, card.objectid, { noSelections: true });
       });
       };

这是我编写的代码。但是没有运气。它对我不起作用。我想在到达滚动底部后显示5个5条记录。谁能帮我怎么做?

0 个答案:

没有答案