class tableTransactions {
constructor() {
this.appState = "account";
}
initialize(id, data) {
// register the sort datetime format
$.fn.dataTable.moment('MMM Do YYYY HH:mm:ss');
var namesType = $.fn.dataTable.absoluteOrder(
[
{ value: null, position: 'top' }
]);
// render the transactions
$(id).DataTable({
"paging": false,
"scrollY": "calc(100vh - 115px)",
"responsive": true,
"processing": true,
"order": [[ 1, "desc" ]],
"data": data,
"oSearch": {"sSearch": EthoTransactions.getFilter() },
"columnDefs": [
{
"targets": 0,
"render": function ( data, type, row ) {
if (data == 0) {
return '';
} else if (data == 1) {
return '';
} else {
return '';
}
}
},
{
"className": "transactionsBlockNum",
"type": namesType,
"targets": 1
},
{
"targets": 2,
"render": function ( data, type, row ) {
return moment(data, "YYYY-MM-DD HH:mm:ss").format("MMM Do YYYY HH:mm:ss");
}
},
{
"targets": 5,
"render": function ( data, type, row ) {
return parseFloat(web3Local.utils.fromWei(EthoUtils.toFixed(parseFloat(data)).toString(), 'ether')).toFixed(2);
}
},
{
"targets": 6,
"defaultContent": "",
"render": function ( data, type, row ) {
if (row[1]) {
return '';
} else {
return '';
}
}
}
],
"drawCallback": function( settings ) {
$("#loadingTransactionsOverlay").css("display", "none");
}
});
}
}
// create new tables variable
EthoTableTransactions = new tableTransactions();