[英]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.