export function attachScrollLoader(gridId, component) { const grid = document.getElementById(gridId); if (!grid) return; const checkScroll = () => { const distanceFromBottom = grid.scrollHeight - (grid.scrollTop + grid.clientHeight); if (distanceFromBottom < 250) { component.invokeMethodAsync('OnScrollNearBottom'); } }; grid.addEventListener('scroll', checkScroll, { passive: true }); grid.__prospectScrollCheck = checkScroll; checkScroll(); } export function disposeScrollLoader(gridId) { const grid = document.getElementById(gridId); if (!grid || !grid.__prospectScrollCheck) return; grid.removeEventListener('scroll', grid.__prospectScrollCheck); delete grid.__prospectScrollCheck; }