Lazy Loading and Responsive Scroll Bar

every time i scroll up the previous data are not cached so it still loads and the scroll bar is not adjusting it is always small as if he knows already there was a large file below how can i make it responsive and cached the data everytime i scroll down because im using lazy loading

When using Grid component the size of the scroll bar is computed based on the count callback or count estimate given via DataView. If the estimate is wildfly off it can produce weird results. If no estimate is given and count callback is not used, the scroll bar height is updated after each fetch callback until the bottom has been reached. Note, it is intentional in Grid that previous fetch results are not being cached, i.e. Grid retains one “page buffer” of data only.

  query -> {
                String filter = query.getFilter().orElse("");
                if (filter.isEmpty()) {
                    return (int) repository.count();
                } else {
                    // For counting, we can fetch the first page and get the total element count from it.
                   return (int )repository.countByBusinessNameContainingIgnoreCase(filter);
                }
            }

this is my code sir

Thanks for that detail. The count query is mandatory when using Filter.

thank you I already figured it out