I have a function within the component and at the same time I am using DataTables button to trigger display a modal. Here's the snippet:
constructor(props) {
super(props);
this.state = {
error: null,
isLoaded: false,
table_type: 'default',
date_time : null,
data: [],
header : null
};
this.toogleBtnTbl = this.props.toogleBtnTbl.bind(this);
this.showModal = this.props.showModal.bind(this);
}
I cant call the function this.showModal inside the button of Datatables because this refers to the Datatables in this case. My question is how to call this.showModal inside the action property?
buttons: [
{
text: 'View in Graph',
action: function ( e, dt, node, config ) {
this.showModal();//not working undefined
}
},
const show = this.Modal();then callshow()