简体   繁体   English

kendo-list-view滚动时如何获取滚动事件

[英]How to get scroll event when kendo-list-view scrolls

I am building a cross platform application using Angular Kendo Mobile. 我正在使用Angular Kendo Mobile构建跨平台应用程序。

I have a Kendo list using "kendo-list-view". 我有一个使用“ kendo-list-view”的剑道列表。

<div kendo-list-view > 

I want to get an event when user scrolls this list, in my controller. 当用户在控制器中滚动此列表时,我想获取一个事件。

I also tried to get the scroll event by using pure angular code, as mentioned in below question. 我还尝试通过使用纯角度代码来获取滚动事件,如下面的问题所述。

Bind class toggle to window scroll event 绑定类切换到窗口滚动事件

But in my case nothing happens and code inside the directive is not getting called. 但就我而言,什么也没有发生,并且指令内的代码没有被调用。

UPDATE 更新

I have my HTML with list view as below: 我的HTML具有列表视图,如下所示:

<kendo-mobile-view id="myListScreen" k-transition="'slide'" k-title="'My List'" k-layout="'default'" ng-controller="myListCtrl">

    <kendo-mobile-header >
        <kendo-mobile-nav-bar style="background-color: gray">
            <kendo-view-title style="color: white"></kendo-view-title>
            <kendo-mobile-button k-rel="'drawer'" href="#navDrawer" k-align="'left'"><img src="img/menu.png"></kendo-mobile-button>
        </kendo-mobile-nav-bar>
    </kendo-mobile-header>

    <div class="myListMainDiv">
        <div kendo-list-view 
             id="myListViewDiv"
             class="myListViewDiv"
             k-template="templates.myListViewItem" 
             k-data-source="myService.listDataSource" 
             ng-show="showListSelected"
             ></div>
   </div>

   <script id="myListViewItem" type="text/x-kendo-template">
        <div id="{{dataItem.id}}" ng-click="onSelected(dataItem.id)">
           {{dataItem.name}}
        </div>
   </script>

</kendo-mobile-view>

I am loading this page in my root page when user selects to navigate to this page using kendo.mobile.application.navigate("MyList.html"); 当用户选择使用kendo.mobile.application.navigate("MyList.html");导航到该页面时,我正在将此页面加载到我的根页面中kendo.mobile.application.navigate("MyList.html"); . And when controller for this page loads I have created list using new kendo.data.DataSource and I have attached new kendo.data.ObservableArray to my data source. 而当这个页面加载我一直在使用创建的列表控制器new kendo.data.DataSource和我重视new kendo.data.ObservableArray我的数据源。

You can get the scroll event from the Scroller of your Kendo Mobile View, For example if you have a view with id="myListScreen" : 您可以从Kendo Mobile视图的Scroller中获取滚动事件,例如,如果您的视图具有id="myListScreen"

    var kendoView = $('#myListScreen').data().kendoMobileView;
    var scroller = kendoView.scroller;

    scroller.bind("scroll", function(e) {
        console.log(e.scrollTop);
        console.log(e.scrollLeft);
    });

You can find more info about the kendo scroller here on their documentation 您可以在其文档中找到有关剑道滚动条的更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 当用户在角度js中滚动到顶部时如何获取事件? - how to get event when user scroll to top in angular js? 如何在angularjs中检查Kendo树视图数据绑定事件? - How to check Kendo tree-view databound event in angularjs? angularjs ui-grid滚动条到达终点时如何获取事件 - How can I get an event when angularjs ui-grid scroll bar reaches the end 使用Angular Kendo进行剑道列表视图时不显示任何结果 - Display no results using Angular Kendo for kendo list view ng-view和scroll事件 - ng-view and scroll event Kendo Pager不使用Kendo列表视图数据源更新 - Kendo Pager not updating with kendo list view data source 如何通过kendo和angular初始化视图? - How to init view by kendo and angular? $ ionicScrollDelegate.scrollTop()不允许我向下滚动列表后手动向上滚动 - $ionicScrollDelegate.scrollTop() doesn't allow me to scroll up manually after it scrolls down my list 在Angular JS中如何在滚动中显示元素 - How to ng-show element on scroll when it is into view in Angular JS 角度ui选择选项不会在离子视图和离子模态视图上滚动,但会在离子弹出窗口上滚动 - angular ui-select choices doesnt scroll on ion-view and ion-modal-view but scrolls on ion-popup
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM