Scrolling events in RadzenDataGrid

Hi,

I'm using RadzenDataGrid with a scrollbar (Blazor server-side) and need to be able to hook into the scroll event using JavaScript.

I've tried attaching a 'scroll' event handler to various elements in the data grid but none fire the scroll event.

Is there a way to do this?

Hi @Hallupa,

Not sure why you need this however I'm afraid it's not possible in the markup. For sure you can find the relevant HTML element using JavaScript and attach desired event programmatically - use your browser dev tools to find what you are looking for.

Thanks @enchev

I tried finding the HTML element using this:

    document.querySelector('.rz-data-grid').addEventListener('scroll', (e) => { 
        console.log('1')
    });
    document.querySelector('.rz-data-grid-data').addEventListener('scroll', (e) => {
        console.log('2')
    });
    document.querySelector('.rz-grid-table').addEventListener('scroll', (e) => {
        console.log('3')
    });

But not getting the scroll event so far

Thank you @enchev - it works for me also now if I do this:

$(document).ready(function () {
    setTimeout(function () {
        document.querySelector('.rz-data-grid-data').addEventListener('scroll', (e) => {
            console.log('2')
        }, true);
    }, 10000);
});

I originally did it like this, which doesn't work:

$(document).ready(function () {
    document.querySelector('.rz-data-grid-data').addEventListener('scroll', (e) => {
        console.log('2');
    });
}

So Blazor seems to need a more time to setup before subscribing to the events.
Is there a better event rather than document 'ready' for me to set up the subscriptions so I can avoid having the 10s delay?