Grid Pager Crashes When DataSource.data = []

2 posts, 0 answers
  1. Harlan
    Harlan avatar
    19 posts
    Member since:
    Dec 2014

    Posted 09 Aug Link to this post

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

     

  2. Harlan
    Harlan avatar
    19 posts
    Member since:
    Dec 2014

    Posted 09 Aug in reply to Harlan Link to this post

    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.
  3. Kendo UI is VS 2017 Ready
Back to Top