Page 1 of 1

DataTable Lazy loading example

Posted: 03 Sep 2018, 00:08
by vba66a
Hi,

Can you please advise why DataTable example (from https://www.primefaces.org/primereact/#/datatable/lazy) does not work?
Please check https://stackblitz.com/edit/react-o4egxk?file=Lazy.js

Clicking on arrows result in error:
Error in 1.6.2/components/datatable/DataTable.js (89:17)
this.props.onLazyLoad is not a function

I tried to make it work with my own data service and table got data and even clicks on page numbers on paginator work, but clicking on arrows to move to next page always produces calls to page 1 .. Can anyone provide an example of wroking Lazy-loaded DataTable where arrows function as expected?

Regards,
VB

Re: DataTable Lazy loading example

Posted: 03 Sep 2018, 13:20
by cagatay.civici
Please try with PrimeReact 2.0.0-beta.3.

Re: DataTable Lazy loading example

Posted: 03 Sep 2018, 15:52
by sudheer
I can't replicate the issue. May be showcase deployed with latest release?

Re: DataTable Lazy loading example

Posted: 04 Sep 2018, 05:27
by vba66a
Indeed ... using 2.0.0-beta.3 fixed the issue: https://stackblitz.com/edit/react-o4egxk
.. now need to make it work with my API :)

Thanks!
VB

Re: DataTable Lazy loading example

Posted: 04 Sep 2018, 09:40
by cagatay.civici
Glad to hear.

Re: DataTable Lazy loading example

Posted: 07 Sep 2018, 03:15
by vba66a
Ok, it's me again.
I need help with DataTable lazy loading in React/Redux app. Can someone please take a look at my example code at https://stackblitz.com/edit/react-iabk8 ... atients.js

[Note that example does not load data from external API (CORS issue maybe - even though I have Access-Control-Allow-Origin: * ) - and somehow all I'm getting is TypeError while trying to fetch data.. but that's not the main problem. This part works locally so I did not focus on fixing it for demo]

When I click on page number 2 or on the 'next' arrow - console.log shows that I'm requesting page 1 - even though I'd expect to see 2. Clicking on 'last' correctly requests page 10 and 'first' page 1.

Can you please advise what's happenning? I suspect it's a conflict between Redux setting the state and onPage handler also setting the state .. but I'm at loss how to fix it :cry:

Any help will be highly appreciated!
VB

Re: DataTable Lazy loading example

Posted: 09 Sep 2018, 06:07
by vba66a

Re: DataTable Lazy loading example

Posted: 26 Mar 2019, 07:17
by Aidan2451
Deferred loading of data. When using DataTables with server-side processing, the default behaviour is to have DataTables automatically make an Ajax call and load the data, removing anything which might have already been in the table mybkexperience.