diff --git a/src/kibana/components/doc_table/doc_table.js b/src/kibana/components/doc_table/doc_table.js index 7d6d2fe438cef4..d2c04a69d24fc4 100644 --- a/src/kibana/components/doc_table/doc_table.js +++ b/src/kibana/components/doc_table/doc_table.js @@ -11,7 +11,7 @@ define(function (require) { require('components/doc_table/components/table_row'); require('modules').get('kibana') - .directive('docTable', function (config, Notifier) { + .directive('docTable', function (config, Notifier, getAppState) { return { restrict: 'E', template: html, @@ -57,7 +57,11 @@ define(function (require) { // 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'); + if (columns.length !== 0) return; + + var $state = getAppState(); + $scope.columns.push('_source'); + if ($state) $state.replace(); }); $scope.$watchCollection('columns', function (columns, oldColumns) {