Added csv file generation
This commit is contained in:
parent
b5d502273d
commit
f1adde8e44
2 changed files with 35 additions and 1 deletions
|
|
@ -19,11 +19,33 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
|||
$scope.alternativeCurrency = [];
|
||||
|
||||
|
||||
|
||||
$scope.selectPage = function(page) {
|
||||
$scope.currentPage = page;
|
||||
$scope.update();
|
||||
};
|
||||
|
||||
|
||||
|
||||
$scope.downloadHistory = function() {
|
||||
var data = $scope.blockchain_txs;
|
||||
var csvContent = "data:text/csv;charset=utf-8,";
|
||||
|
||||
data.forEach(function(it, index) {
|
||||
var dataString = it.ts + ',' + it.amount + ',' + it.action + ',' + it.addressTo;
|
||||
csvContent += index < data.length ? dataString + "\n" : dataString;
|
||||
});
|
||||
|
||||
var encodedUri = encodeURI(csvContent);
|
||||
var link = document.createElement("a");
|
||||
link.setAttribute("href", encodedUri);
|
||||
link.setAttribute("download", "my_data.csv");
|
||||
|
||||
link.click();
|
||||
};
|
||||
|
||||
|
||||
|
||||
$scope.update = function() {
|
||||
$scope.getTransactions();
|
||||
};
|
||||
|
|
@ -73,6 +95,8 @@ angular.module('copayApp.controllers').controller('HistoryController',
|
|||
|
||||
|
||||
$scope.hasAction = function(actions, action) {
|
||||
|
||||
|
||||
return actions.hasOwnProperty('create');
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue