Я хочу передать значения в функцию (e, dt, node, config) для dtOptions.buttons
угловой 6
Как передать значения в функцию (e, dt, node, config) для dtOptions.buttons?
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-buttons-extension',
templateUrl: 'buttons-extension.component.html'
})
export class ButtonsExtensionComponent implements OnInit {
// Must be declared as "any", not as "DataTables.Settings"
dtOptions: any = {};
val=10;
ngOnInit(): void {
this.dtOptions = {
ajax: 'data/data.json',
columns: [{
title: 'ID',
data: 'id'
}, {
title: 'First name',
data: 'firstName'
}, {
title: 'Last name',
data: 'lastName'
}],
// Declare the use of the extension in the dom parameter
dom: 'Bfrtip',
// Configure the buttons
buttons: [
'columnsToggle',
'colvis',
'copy',
'print',
'excel',
{
text: 'Some button',
key: '1',
action: function (e, dt, node, config) {
alert(this.val);
}
}
]
};
}
}
console.log:
не определен