Search code examples
javascriptnode.jssails.jswaterline

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


I want to create paginated table using sails.js, mongodb and waterline-ORM.

Is there a any specific way to do pagination in sails.js?


Solution

  • http://sailsjs.org/#/documentation/concepts/ORM/Querylanguage.html

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

    If you want the pagination to work asynchronously, its very easy to do with JQUERY $$.getJSON and on the server res.json();

    Theres a lot of info in waterline and sails docs.