Skip to content

Commit

Permalink
[Helpers][Data-Grid] Added support for SQL joined counts.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jack12816 committed Jan 9, 2014
1 parent 7953478 commit 0eb5c47
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/helper/controller/data-grid.js
Expand Up @@ -69,7 +69,8 @@ DataGrid.prototype.buildSqlPagination = function(sqlCriteria, options, callback)
greppy.db.get(options.connection).getORM(function(orm, models) {

models[options.entity].count({
where : sqlCriteria.where
where: sqlCriteria.where,
include: sqlCriteria.include
}).success(function(count) {

callback && callback(null, {
Expand Down Expand Up @@ -100,6 +101,9 @@ DataGrid.prototype.buildSqlCriteria = function(req, res, options)
var order = undefined;
var properties = null;

// Add includes to criteria object
sqlCriteria.include = options.include || undefined;

// Searching
if (req.query.search && req.query.sprop) {

Expand Down

0 comments on commit 0eb5c47

Please sign in to comment.