We are manually configuring the datasource for our Grid Pager. I realize Kendo UI has provisions for this already, but for reasons I'm currently unsure of, we have found we need to manually manage our grid pager and keep it in sync with our grid, which works quite well.
The issue is that when the server returns no data (zero records), I'd like to set the Pager to zero records, but when I do it this way as shown below, I get a Maximum Call Stack Exceeded in the init._valueExpr function on the line that says comparer = new Function('current', 'values', body); Note that line of code is inside a loop and I'm assuming the loop simply runs until the call stack is exceeded, but I'm not sure.
Is there a better way to handle this?
var
data = getPagerData(total);
if
(total > 0) {
my.gridPager.dataSource.data(data);
}
else
{
var
empty = [];
my.gridPager.dataSource.data(empty);
}
function
getPagerData(length) {
var
pagerData = [];
for
(
var
i = 0; i < length; i++) {
pagerData.push({});
}
return
pagerData;
}