I need to render a button inside a cell. I'm using something like this
const columns = [
? { name: 'id', header: 'Id', defaultVisible: false, defaultWidth: 60, type: 'number' },
? { name: 'name', header: 'Name', defaultFlex: 1 },
? { name: 'actions', header: 'Actions', defaultFlex: 1,
??? render: ({ value })=> return (<Button onClick={()=>this.myfunction()}>My button</Button>)
? },
? { name: 'city', header: 'City', defaultFlex: 1 },
? { name: 'age', header: 'Age', defaultFlex: 1, type: 'number' }
];
The problem is that the columns is defined outside my main component class as in your examples. Hence the context "this.myfunction()" will not work. How could I achieve that? In my test, the button renders but onclick I get an error
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…