From 77c2d4fdeaa79b16e43187e1c7c0b588d0fef072 Mon Sep 17 00:00:00 2001 From: Erick Tryzelaar Date: Mon, 27 Jan 2014 16:06:04 -0800 Subject: [PATCH] Sort the vertex property columns and filter _vertexId --- src/main/webapp/js/controllers.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/main/webapp/js/controllers.js b/src/main/webapp/js/controllers.js index d867ffe..e1a1806 100644 --- a/src/main/webapp/js/controllers.js +++ b/src/main/webapp/js/controllers.js @@ -464,7 +464,6 @@ angular.module('dendrite.controllers', []). // build array of results var resultArray = []; var resultKeys = {}; - var sortDirections = []; data.hits.hits.forEach(function(hit) { if (hit._type === $scope.objectType) { hit._source._id = hit._source.vertexId; @@ -472,7 +471,7 @@ angular.module('dendrite.controllers', []). // extract all keys (to dynamically update table columns) Object.keys(hit._source).forEach(function(k) { - if (k !== ($scope.objectType+'Id') && k !== "_id") { + if (k !== ($scope.objectType+'Id') && k !== "_id" && k !== "_vertexId") { resultKeys[k] = true; } }); @@ -507,6 +506,16 @@ angular.module('dendrite.controllers', []). } }); + $scope.columnDefs.sort(function(a, b) { + if (a.field < b.field) { + return -1; + } else if (a.field > b.field) { + return 1; + } else { + return 0; + } + }); + // update sort options $scope.sortOptions.fields = sortFields; $scope.sortOptions.directions = sortDirections;