primereact icon indicating copy to clipboard operation
primereact copied to clipboard

DataTable: page is not reseted after global filtering

Open RushPVA opened this issue 9 years ago • 6 comments

I have DataTable without lazy loading with pagination and global filter. If I click to second page and then change filter input to leave only one record in table, then DataTable will not be reseted to the first page. The issue is reproducible on the demo page. https://www.primefaces.org/primereact/#/datatable/filter

http://prntscr.com/hb64za

RushPVA avatar Nov 16 '17 10:11 RushPVA

@RushPVA, hello, i tried to reproduce this issue in demo page, but for me it works fine. datable-demo.pptx

Please check your browser console log to possible errors. If you are using google chrome, you can add https://chrome.google.com/webstore/detail/react-developer-tools/fmkadmapgofadopljbjfkapdkoienihi to help you

ebonventi avatar Nov 16 '17 14:11 ebonventi

try global filter(not column filter)

RushPVA avatar Nov 17 '17 12:11 RushPVA

i reproduced this issue on the last versions of Firefox and Chrome

RushPVA avatar Nov 17 '17 12:11 RushPVA

It's happening on https://www.primefaces.org/primereact/#/datatable/filter (version maybe 2.0.0-rc.1)

Steps:

  1. Go to any page except the first page
  2. Search global with any value of the first page (ex. ee8a89d8)

Expects: Database should show 1 row contains ee8a89d8 at page 1

Actual: Database shows page 1 but with empty data

qmn1711 avatar Dec 05 '18 09:12 qmn1711

it doesnt work in React >= 16.7. maybe it's a componentWillReceiveProps method deprecation issue?

djapal avatar Feb 13 '19 09:02 djapal

Workaround :

Add ref in the datatable definition <DataTable ref={(el) => this.dt = el} . . . </DataTable>

Add this line when the global filter value change this.dt.setState({ first: 0 });

amayde avatar Mar 05 '19 11:03 amayde