我有一个DataTable
这样的:
render() {
return(
<div>
<DataTable value={this.props.members} header="Members"
selectionMode="single" onSelectionChange={this.onMemberSelected}
>
<Column field='name' header='Name' sortable />
<Column field='lastName' header='Last Name' sortable />
<Column field='address' header='Address' sortable />
<Column field='country' header='Country' sortable />
<Column body={ (member, _) => {
return this.renderDeleteButton(member);
} }/>
</DataTable>
</div>
);
}
renderDeleteButton(member) {
return (
<Button
label="Delete"
onClick={ e => {
//delete member
}}
/>
);
}
onMemberSelected(e) {
//show member detail
}
当我按下“删除”按钮时,它会显示成员详细信息,因为该行正在处理事件并被onMemberSelected
调用。
我该如何解决这个问题?