Forcing scrollbar into Datatable component

UI Components for React
Post Reply
Posts: 4
Joined: 21 May 2019, 11:09

03 Jul 2019, 17:43

Hi everyone,
I need to force the vertical datatable scroll bar to the top when some event happens.
I'm working with lazy loading and virtual scrollbar into the Datatable component.
I've tested it in plunker with an easy <div> and it works, but the issue is to bind the right part as it seems scrollbar doesn't belong directly to the Datatable component. I've tried to create a ref to the Datatable, but nothing happens.

Here the example which works fine:

Code: Select all

class ReadyToScroll extends Component {

    constructor(props) {
        this.myRef = React.createRef()   // Create a ref object 

    render() {
        return <div ref={this.myRef}></div> 
    scrollToMyRef = () => window.scrollTo(0, this.myRef.current.offsetTop)   

Any thought?


Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest