Skip to content

Commit

Permalink
Add bugfix watcher for cases when initial column set is undefined or …
Browse files Browse the repository at this point in the history
…empty
  • Loading branch information
Rashid Khan committed Apr 8, 2015
1 parent ecd3d88 commit a4f9bbd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/kibana/components/doc_table/doc_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ define(function (require) {
$scope.limit += 50;
};

// This exists to fix the problem of an empty initial column list not playing nice with watchCollection.
$scope.$watch('columns', function (columns) {
if (columns.length === 0) $scope.columns.push('_source');
});

$scope.$watchCollection('columns', function (columns, oldColumns) {
if (oldColumns.length === 1 && oldColumns[0] === '_source' && $scope.columns.length > 1) {
_.pull($scope.columns, '_source');
Expand Down

0 comments on commit a4f9bbd

Please sign in to comment.