5
我在剑道UI剑道UI:从URL
到目前为止,我已经成功地从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,
});
}
每页上会显示多少项目?它应该大致(项目* 3 * 2)。基本上,如果你在屏幕上显示5个项目,无休止的滚动需要在DOM中加载至少15个项目,所以pageSize应该是那个的两倍,或者30. – zkent
另外,你为什么要硬编码schema.total?这应该是动态的,并且包含将显示的所有记录的总数,而不考虑pageSize。 – zkent