Scroll table to the specific row

UI Components for React
Post Reply
berdyshev
Posts: 1
Joined: 06 Jun 2018, 06:11

06 Jun 2018, 06:22

Is there any way to scroll DataTable with virtual scroll to any specific row?
I need to allow users to navigate to the table's page with row id as URL parameter and I need to scroll data table to the specified row.

merve7
Posts: 861
Joined: 12 Sep 2017, 10:44

11 Jun 2018, 11:41

You can use lazy load and virtual scroll with first attribute to the specified row. Like;

Code: Select all

  
<DataTable header="VirtualScroll with Lazy Loading" value={this.state.lazyCars} first={100} scrollable={true} scrollHeight="200px" virtualScroll={true}
                     rows={10} totalRecords={this.state.lazyTotalRecords} lazy={true} onLazyLoad={this.loadCarsLazy} style={{marginTop:'30px'}}>
       <Column field="vin" header="Vin" />
       <Column field="year" header="Year" />
       <Column field="brand" header="Brand" />
       <Column field="color" header="Color" />
</DataTable>
Also you can read documentation for lazy or first (http://primefaces.org/primereact/#/datatable)

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 18 guests