Hello,
I have a problem with the method stopEndlessScrolling, what happens is that initially I load my data well (image1). when I go down scroller, it still works well because I have yet to send me the data server (image2). When the server has no more data to send me what I do is stop the scroller with stopEndlessScrolling method after that the scroll is lost and fails to display the data (image3). Additionally, it is assumed that the endless scrolling a request each time scroll down the page by changing the number, but I can see that after there is no more data to bring the server, makes many requests and I do not understand why. This is my code:
I have a problem with the method stopEndlessScrolling, what happens is that initially I load my data well (image1). when I go down scroller, it still works well because I have yet to send me the data server (image2). When the server has no more data to send me what I do is stop the scroller with stopEndlessScrolling method after that the scroll is lost and fails to display the data (image3). Additionally, it is assumed that the endless scrolling a request each time scroll down the page by changing the number, but I can see that after there is no more data to bring the server, makes many requests and I do not understand why. This is my code:
<
div
data-role
=
"view"
data-title
=
"Art de inventario"
data-layout
=
"layout_inventory"
data-init
=
"filterableInventoryList"
data-model
=
"inventoryModel"
>
<
ul
id
=
"inventoryList"
data-role
=
"listview"
>
</
ul
>
</
div
>
<
script
id
=
"inventoryTemplate"
type
=
"text/x-kendo-template"
>
<
div
class
=
"row"
>
<
img
class
=
"pullImage"
src
=
"#=Photo#"
/>#= Name #
<
div
class
=
"metadata"
>
<
span
class
=
"sublink"
>Código : #=Code#</
span
>
</
div
>
</
div
>
</
script
>
function filterableInventoryList(e){
var wid = $(window).width();
var dataSource = new kendo.data.DataSource({
pageSize: 12,
serverPaging: true,
serverFiltering: true,
transport: {
read:{
url: localStorage.getItem("url") + "GetInventoryItems",
dataType: "json",
contentType: "application/json; charset=utf-8"
},
parameterMap: function(options) {
var b = selectMenuModel.get("branch");
var filter = options.filter ? options.filter.filters[0].value : "";
var parameters = {
url: JSON.stringify(localStorage.getItem("url")),
width : wid,
branchId : JSON.stringify(b.Branch_Id),
q: JSON.stringify(filter),
count: options.pageSize,
page: options.page
}
return parameters;
}
},
schema: { // describe the result format
data: "d", // the data which the data source will be bound to is in the "results" field
model : { ...
},
change: function() {
//check whether any data is returned
if (!this.view()[0]) {
//disable endless scroll
$("#inventoryList").data("kendoMobileListView").stopEndlessScrolling();
}
}
});
$("#inventoryList").kendoMobileListView({
dataSource: dataSource,
template: $("#inventoryTemplate").text(),
filterable: {
filterable: true,
placeholder: "Buscar Item..."
},
endlessScroll: true,
scrollTreshold: 30 //treshold in pixels
});
}