我正在研究剑道 UI 中的无限滚动功能
到目前为止,我已经设法从 url 加载数据并显示在列表中,但是一旦我的列表结束,我需要从下一个 url 加载数据
这是我的代码
var i = 0, pageSize = 10;
function mobileListViewEndlessScrolling() {
var dataSource = new kendo.data.DataSource({
type: "odata",
transport :
read: {
type : "GET",
url : "https://graph.facebook.com/siedae/feed?access_token=150129068491462|a8HxcqfRA-Bn1M59A_wefbEMs9c",
contentType: "application/json; charset=utf-8",
dataType : "json",
error : function (xhr, ajaxOptions, thrownError) {
alert("error " + xhr.responseText);
},
}
},
serverPaging: true,
pageSize: pageSize,
schema: {
data : "data",
total: function() { return 25; }
},
});
$("#endless-scrolling").kendoMobileListView({
dataSource: dataSource,
template: $("#endless-scrolling-template").text(),
endlessScroll: true,
scrollTreshold: 30,
});
}
最佳答案
您可以定义 dataSource.transport.read.url
作为一个函数。每次 dataSource 即将发出读取请求时都会执行该函数,这将使您有机会在运行时更改 URL。
http://docs.telerik.com/kendo-ui/api/javascript/data/datasource#configuration-transport.read.url
关于kendo-ui - 剑道用户界面 : Endless scroll load from URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21621383/