1
所以我想實現與帆更直截了當分頁和而不是使用當前頁或剛剛頁面跳轉......帆API:藍圖分頁 - 自定義實現
所以,我已經實現了自定義查找操作,取代默認的一個... https://github.com/randallmeeker/SailsBluePrintActions
這個填充在響應
在這裏的附加信息對象是源 https://github.com/randallmeeker/SailsBluePrintActions/blob/master/pagination/inBody/find.js
所以我做什麼,我說這個
module.exports = function findRecords(req, res) {
// definde page if exists
var page = req.param("page", null);
....
if (page) {
query = Model.find()
.where(actionUtil.parseCriteria(req))
.paginate({
page: page,
limit: actionUtil.parseLimit(req)
})
.sort(actionUtil.parseSort(req));
} else {
query = Model.find()
.where(actionUtil.parseCriteria(req))
.limit(actionUtil.parseLimit(req))
.skip(actionUtil.parseSkip(req))
.sort(actionUtil.parseSort(req));
}
的問題是,我得到頁面查詢參數(帆搜索參數)...我想從參數
列表中刪除所以我想是這樣的:
var page = req.param("page", null);
if(page){
console.log(page);
delete req.query.page;
}
但帆仍然術語網頁搜索..
什麼是正確的方式做到這一點?
我發現有一個黑名單定義在帆qhen解析parayes req.options.criteria.blacklist ...所以只是將它添加在那裏..我認爲這將解決它 –