DataTable Lazy loading example

UI Components for React
Post Reply
vba66a
Posts: 16
Joined: 25 Jun 2018, 05:22

03 Sep 2018, 00:08

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

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

03 Sep 2018, 13:20

Please try with PrimeReact 2.0.0-beta.3.

User avatar
sudheer
PrimeFaces Core Developer
Posts: 4345
Joined: 16 Oct 2011, 19:19
Location: Singapore

03 Sep 2018, 15:52

I can't replicate the issue. May be showcase deployed with latest release?
Author,Speaker
https://twitter.com/sudheerjonna
Github: https://github.com/sudheerj
Website http://sudheerjonna.com/

___________________
Sudheer Jonna

vba66a
Posts: 16
Joined: 25 Jun 2018, 05:22

04 Sep 2018, 05:27

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

cagatay.civici
Prime
Posts: 18616
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

04 Sep 2018, 09:40

Glad to hear.

vba66a
Posts: 16
Joined: 25 Jun 2018, 05:22

07 Sep 2018, 03:15

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

vba66a
Posts: 16
Joined: 25 Jun 2018, 05:22

09 Sep 2018, 06:07


Aidan2451
Posts: 1
Joined: 26 Mar 2019, 07:15

26 Mar 2019, 07:17

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.

Post Reply

Return to “PrimeReact”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 5 guests