diff --git a/platform/features/table/res/templates/telemetry-table.html b/platform/features/table/res/templates/telemetry-table.html index fa91a39d06..9f64ea29b6 100644 --- a/platform/features/table/res/templates/telemetry-table.html +++ b/platform/features/table/res/templates/telemetry-table.html @@ -9,6 +9,7 @@ enableSort="true" auto-scroll="autoScroll" default-sort="defaultSort" + export-as="{{ exportAs }}" class="tabular-holder has-control-bar"> diff --git a/platform/features/table/src/controllers/MCTTableController.js b/platform/features/table/src/controllers/MCTTableController.js index 4ad17304ff..9d814b4c7a 100644 --- a/platform/features/table/src/controllers/MCTTableController.js +++ b/platform/features/table/src/controllers/MCTTableController.js @@ -88,13 +88,18 @@ define( setDefaults($scope); $scope.exportAsCSV = function () { - var headers = $scope.displayHeaders; + var headers = $scope.displayHeaders, + filename = $(element[0]).attr('export-as'); + exportService.exportCSV($scope.displayRows.map(function (row) { return headers.reduce(function (r, header) { r[header] = row[header].text; return r; }, {}); - }), { headers: headers }); + }), { + headers: headers, + filename: filename + }); }; $scope.toggleSort = function (key) { diff --git a/platform/features/table/src/controllers/TelemetryTableController.js b/platform/features/table/src/controllers/TelemetryTableController.js index 1413c955ff..03b728bb37 100644 --- a/platform/features/table/src/controllers/TelemetryTableController.js +++ b/platform/features/table/src/controllers/TelemetryTableController.js @@ -78,6 +78,8 @@ define( this.domainObject = objectUtils.toNewFormat($scope.domainObject.getModel(), $scope.domainObject.getId()); + this.$scope.exportAs = this.$scope.domainObject.getModel().name; + _.bindAll(this, [ 'destroy', 'sortByTimeSystem',