Skip to content

dataTable onScroll not working #110

Closed Answered by FlipWarthog
mattqs asked this question in PrimeReact
Discussion options

You must be logged in to vote

DataTable itself does not have an onScroll event, but the underlying VirtualScroller does. So you could do something like:

<DataTable
  value={products}
  scrollable
  scrollHeight="100px"
  virtualScrollerOptions={{
    itemSize: 50,
    onScroll: (e) => {
      console.log("e", e);
    }
  }}
  tableStyle={{ minWidth: "50rem" }}
>
  <Column field="code" header="Code"></Column>
  <Column field="name" header="Name"></Column>
  <Column field="category" header="Category"></Column>
  <Column field="quantity" header="Quantity"></Column>
</DataTable>

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by mattqs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants