0

I am new to sails js.In my controller, I am calling an api which gives me a large set of data, approximately 10000 records. I want to show this data in my front end using the datatables, 100 records per page.I don't want all data to be fetched in a single call. Data for each page should be loaded using pagination. Do anyone have any idea? It will be of great help. I am not using the database directly. Everything is via API.

piyushG
  • 11
  • 2

1 Answers1

-1

See Sails.Js - How I do pagination in sails.Js:

In sails.js:

Model.find().paginate({page: 2, limit: 10});

Model.find({ where: { name: 'foo' }, limit: 10, skip: 10 });

(Source: https://stackoverflow.com/a/26653121/3340229)

In the frontend, you can add query parameters for this:

http://yourDomain.com/ModelName?skip=10&limit=10

(Source: https://stackoverflow.com/a/27937261/3340229)

Community
  • 1
  • 1
Iris Schaffer
  • 804
  • 8
  • 18