react-virtualized icon indicating copy to clipboard operation
react-virtualized copied to clipboard

onRowsRendered custom usage with InfiniteLoader and List

Open N0rbis opened this issue 7 years ago • 1 comments

I am working my way through trying to figure out if I can have a custom "onRowsRendered" function.

As per documentation examples, both list and InfiniteLoader utilize onRowsRendered={onRowsRendered}

 {({ onRowsRendered, registerChild }) => (
             <List className="table table-bordered"
               ref={registerChild}
             onRowsRendered={onRowsRendered}
....

However I cannot seem to figure out / find a documented way of customising / modfying the fuction. I am trying to grab the startIndex and stopIndex values, however that completely stops the Infinite loader functionality.

A better example of what I am trying to achieve that works:

    onRowsRendered={({ startIndex, stopIndex }) =>
      this.setState({startIndex: startIndex + 1, stopIndex: stopIndex})
       }

, I need same + Infinite Loader still working 👍

Now it just seems like both Infinite loader and List make user of onRowsRendered property and one cancels out the other. I do realize it's a very rare case, but would love to know if this is a bug or am I just being silly.

And for those wondering why would I need this.. Is to display number of items (From ... To..) which are currently visible, and as users scrolls up / down they update.

N0rbis avatar Nov 18 '19 01:11 N0rbis

you should make some "proxy" to make it works. something like this: onRowsRendered={({ startIndex, stopIndex }) => { onRowsRendered({ startIndex, stopIndex }); _.debounce(handleRowsRendered({ startIndex, stopIndex }),500); }}

erezLieberman avatar Nov 27 '19 17:11 erezLieberman