Sails.Js - 我如何在sails.Js中进行分页 [英] Sails.Js - How I do pagination in sails.Js

查看:186
本文介绍了Sails.Js - 我如何在sails.Js中进行分页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用sails.js,mongodb和waterline-ORM创建分页表。

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

在sails.js中是否有任何特定的分页方式?

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

推荐答案

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

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

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

如果你想让分页异步工作,那么使用JQUERY非常容易 $$。getJSON 并且在服务器上 res.json();

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.

这篇关于Sails.Js - 我如何在sails.Js中进行分页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆