This is a migrated thread and some comments may be shown as answers.

Grid Pager Crashes When DataSource.data = []

1 Answer 94 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Harlan
Top achievements
Rank 1
Harlan asked on 09 Aug 2016, 01:52 PM

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;
}

 

1 Answer, 1 is accepted

Sort by
0
Harlan
Top achievements
Rank 1
answered on 09 Aug 2016, 10:27 PM
OK, I think this might be a problem in some of our code. We've got our own pager.change function and I think we have a bug in it that's causing this issue. I'll post back here if this continues to be a problem and can be duplicated outside of our environment.
Tags
Grid
Asked by
Harlan
Top achievements
Rank 1
Answers by
Harlan
Top achievements
Rank 1
Share this question
or