Skip to content

Commit

Permalink
Sort the vertex property columns and filter _vertexId
Browse files Browse the repository at this point in the history
  • Loading branch information
Erick Tryzelaar committed Jan 28, 2014
1 parent 7c7fbac commit 77c2d4f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/main/webapp/js/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -464,15 +464,14 @@ 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;
resultArray.push(hit._source);

// 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;
}
});
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 77c2d4f

Please sign in to comment.