Hi Guys,
I would like to use the Kendo grid with remote data virtualization. I also need to have a custom method for the transport.read property.
My grid is configured like this:
$(document).ready(
function
() {
$(
"#grid"
).kendoGrid({
dataSource: {
serverPaging:
true
,
serverSorting:
true
,
pageSize: 100,
transport: {
read:
function
(options) {
// Get the template items, which could be products, collections, blogs or articles
getTemplateItems().then(
function
(data) {
options.success(data);
});
}
}
},
height: 543,
scrollable: {
virtual:
true
},
sortable:
true
,
columns: [
{ field:
"title"
, title:
"Title"
}
]
});
});
function
getTemplateItems() {
var
deferred = $q.defer();
smartseoEntityMapping.getEntityInfo({ mappedEntityType: mappedEntityType.Product }).$promise.then(
function
(data) {
deferred.resolve(data);
});
return
deferred.promise;
}
}
The problem is that the read method is only called once when the grid is initialized. It is not called when the scroll reaches the last item in the current visible set.
I suspect that the grid needs the total number of items but I cannot understand how to set the total number of items. Setting a method for the schema.total property does not work because the method is never called.
So I would like to ask you, is this scenario possible at all, to have the virtualization work with a custom transport.read method, which needs to be called
every time to get the next page of data?
Why I am using a custom read? Well I need to because my remote call involves setting authentication, etc...
Thanks