Using the bookshelf-pagemaker NodeJS Module:
I have added support for this in the freshly published version 0.1.3. You can now supply a where statement to the args object you pass to the paginate function. the sql statement you supply will be added with an and to the filter sql so you will still be able to use search functionality
your args object would look like
var args = {
params: {
start: offset,
page: pageNum,
length: pageSize
},
model: UserDAO,
where: '(id > 10 AND id < 100)'
};
var resultObj = pagemaker.datatables.paginate(args);
resultObj.then(function (result) {
paginateHandler(result);
});
}
function paginateHandler (result)
{
var numPaginatedRecords = result.recordsFiltered;
var pagesTotal = Math.ceil(numPaginatedRecords / ITEMS_ON_PAGE);
res.render('my_paginated_view', {
data: result.data,
currentPage: ,
pagesCount: pagesTotal
});
};