'use strict';

var _ = require('lodash');

var utils = require('./utils');

module.exports = function (schema) {
  var columnDefs = utils.getPaths(schema, {});

  function toColumnsSchema(){
    return _.select(columnDefs, function(col){ return col.isCollumn !== false;});
  }

  function getUiGridColumnsProjection(config){
    if (config && config.filter) {
      columnDefs = columnDefs.filter(function(el) {return el.filter === config.filter || el.field === '_id';})
    }

    return _.pluck(columnDefs, 'field').join(' ');
  }

  schema.statics.getUiGridColumnProjection = getUiGridColumnsProjection;
  schema.statics.getUiGridColumnDefinition = toColumnsSchema;
  schema._uiGridProjection = toColumnsSchema();
};
@@ -376,26 +376,45 @@
 s = 
-columnDefs.filter(
+_.select(utils.getPaths(schema, %7B%7D), 
 func
@@ -482,16 +482,17 @@
 '_id';%7D)
+;
 %0A    %7D%0A%0A

add fetaure