javascript - Callback for scroll event in Kendo UI grid - Stack Overflow

I have 2 tables rendered with kendo grid, these are scrollable. I have code which needs to be executed

I have 2 tables rendered with kendo grid, these are scrollable. I have code which needs to be executed whenever the scroll happens in any of the table.

I've tried

jQuery("#grid").kendoGrid({
    dataSource : dataSource,
    columns : [{
        field : 'name',
        title : 'Name',
        width : '160px'
    }, {
        field : 'dataTypeId.name',
        title : 'Type',
        width : '70px'
    }],
    height : 270,
    scrollable : true,
    AfterScroll: function() {
        console.log("scrolled");
    },
    rowTemplate : kendo.template(jQuery("#custom-input-grid-rows").html()),
}).data("kendoGrid");

I tried to put some callbacks like onScroll, AfterScroll but they did not work for me.

How do I get a callback when scrolling happens in the kendo grid?

I have 2 tables rendered with kendo grid, these are scrollable. I have code which needs to be executed whenever the scroll happens in any of the table.

I've tried

jQuery("#grid").kendoGrid({
    dataSource : dataSource,
    columns : [{
        field : 'name',
        title : 'Name',
        width : '160px'
    }, {
        field : 'dataTypeId.name',
        title : 'Type',
        width : '70px'
    }],
    height : 270,
    scrollable : true,
    AfterScroll: function() {
        console.log("scrolled");
    },
    rowTemplate : kendo.template(jQuery("#custom-input-grid-rows").html()),
}).data("kendoGrid");

I tried to put some callbacks like onScroll, AfterScroll but they did not work for me.

How do I get a callback when scrolling happens in the kendo grid?

Share Improve this question edited Jul 17, 2014 at 14:29 gitsitgo 6,8093 gold badges35 silver badges45 bronze badges asked Jul 16, 2014 at 6:22 StrikersStrikers 4,7762 gold badges31 silver badges59 bronze badges 1
  • Those events don't exist in kendo grid, so you can't just simply attach it to the grid definition like that. Also, there is a very big difference between "on" and "after" scroll, please clarify which one you want. – gitsitgo Commented Jul 17, 2014 at 14:36
Add a ment  | 

2 Answers 2

Reset to default 3

Hi got the same question today, and fixed it this way:

Attach the jQuery event .scroll() right after your Kendo Grid was initialized like:

$('#GridName .k-grid-content').scroll(function () { 
    alert('I am scrolling ...'); 
});

The above didn't work for me either, but led me along the correct lines. The k-virtual-scrollable-wrap class handles the the scrollable part of the grid (eg when you have frozen columns enabled), so try this code instead:

$('.k-virtual-scrollable-wrap').scroll(function () { 
    console.log("I am scrolling"); 
});

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745672526a4639492.html

相关推荐

  • javascript - Callback for scroll event in Kendo UI grid - Stack Overflow

    I have 2 tables rendered with kendo grid, these are scrollable. I have code which needs to be executed

    6小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信