我在我的反应应用程序中使用了固定数据表。我对这个概念不熟悉固定数据表。通过调用cellRenderer中的函数来解决问题会触发一个事件。在那个i& #39; m通过onClick事件触发函数但是我收到错误未捕获TypeError:r.openDeletePopUp不是函数帮我解决这个问题。 这是我的代码,请看看
import React from 'react';
import ReactDOM from 'react-dom';
import {Table, Column, Cell} from 'fixed-data-table';
import 'fixed-data-table/dist/fixed-data-table.css';
ButtonDelete(cellData, cellDataKey, rowData, rowIndex){
var _id=(JSON.stringify(rowData._id)).replace(/\"/g, "");
var isDelete=(JSON.stringify(rowData.isDelete)).replace(/\"/g, "");
return(
<span className="btn btn-primary btnDel" type="button" style={{marginLeft: 10}} onClick={() => this.openDeletePopUp(_id, isDelete)}>
<span style={{fontFamily: 'verdana',fontSize: 12}} >DELETE</span>
</span>
)
}
openDeletePopUp(_id,value){
$('#OpenDeleteComment').modal('show');
}
<Table
rowHeight={75}
headerHeight={50}
rowGetter={(rowIndex) => {
return this.state.categories[rowIndex]
}}
rowsCount={this.state.categories.length}
width={1500}
height={500}
{...this.props}>
<Column
label="Icon"
cellRenderer= {this.Images}
fixed={true}
width={75}
/>
<Column
label={this.state.type+"name"}
cellRenderer= {this.name}
fixed={true}
width={500}
/>
<Column
label="Created"
cellRenderer= {this.created}
fixed={true}
width={130}
/>
<Column
cellRenderer= {this.ButtonEdit}
fixed={true}
width={130}
/>
<Column
cellRenderer= {this.ButtonDelete}
fixed={true}
width={130}
/>
</Table>
提前致谢