Forcing scrollbar into Datatable component!!!

UI Components for React
Post Reply
ResslerKeen
Posts: 3
Joined: 20 Oct 2019, 07:41

24 Oct 2019, 19:08

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.whatsapp web 192.168.0.1 routerlogin


Here the example which works fine:

Code: Select all

class ReadyToScroll extends Component {

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

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

}

johnamaro
Posts: 1
Joined: 13 Sep 2020, 11:08

13 Sep 2020, 11:13

In the end the best solution was to set the width of the inner table to:

table-layout:fixed;
width: 98% !important;
All solutions listed here had undesirable cropping behavior. Limiting the table width in this way also allowed me to dynamically adjust the height of the table such that the horizontal scrollbar can appear or disappear on demand without introducing an horizontal scroll.https://gbapps.net

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 1 guest