Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何使用大括号中的参数访问react函数中的事件?_Javascript_Reactjs_React Data Grid - Fatal编程技术网

Javascript 如何使用大括号中的参数访问react函数中的事件?

Javascript 如何使用大括号中的参数访问react函数中的事件?,javascript,reactjs,react-data-grid,Javascript,Reactjs,React Data Grid,我有一个函数“handleGridRowsUpdated”,我想访问这个函数中的事件 我尝试过用各种方式将事件传递给这个函数,也用谷歌搜索了一下,但没有成功 下面是代码片段: class App extends React.Component { constructor(props) { super(props); this.handleGridRowsUpdated = this.handleGridRowsUpdated.bind(this); } handle

我有一个函数“handleGridRowsUpdated”,我想访问这个函数中的事件

我尝试过用各种方式将事件传递给这个函数,也用谷歌搜索了一下,但没有成功

下面是代码片段:

class App extends React.Component {
  constructor(props) {
    super(props);
    this.handleGridRowsUpdated = this.handleGridRowsUpdated.bind(this);
  }

  handleGridRowsUpdated({ fromRow, toRow, updated }) {}

  render() {
    return (
      <ReactDataGrid
        ref={node => (this.grid = node)}
        onGridSort={this.handleGridSort}
        enableCellSelect={true}
        columns={this.getColumns()}
        rowGetter={this.getRowAt}
        rowsCount={this.getSize()}
        onGridRowsUpdated={this.handleGridRowsUpdated}
        toolbar={<Toolbar onAddRow={this.handleAddRow} enableFilter={true} />}
        onAddFilter={this.handleFilterChange}
        getValidFilterValues={this.getValidFilterValues}
        onClearFilters={this.handleOnClearFilters}
        enableRowSelect={true}
        rowHeight={50}
        minHeight={600}
        rowScrollTimeout={200}
      />
    );
  }
}
类应用程序扩展了React.Component{
建造师(道具){
超级(道具);
this.handleridrowsupdated=this.handleridrowsupdated.bind(this);
}
handleGridRowsUpdated({fromRow,toRow,updated}){
render(){
返回(
(this.grid=node)}
onGridSort={this.handleGridSort}
enableCellSelect={true}
columns={this.getColumns()}
rowGetter={this.getRowAt}
rowsCount={this.getSize()}
onGridRowsUpdated={this.handleGridRowsUpdated}
工具栏={}
onAddFilter={this.handleFilterChange}
getValidFilterValues={this.getValidFilterValues}
onClearFilters={this.handleOnClearFilters}
enableRowSelect={true}
行高={50}
最小高度={600}
rowScrollTimeout={200}
/>
);
}
}

我是一个新的反应者,任何帮助都将不胜感激。

我不认为
GridRowsUpdated
也是一个事件,例如
onClick
是一个事件。你想完成什么?考虑到你的使用(问题中没有提到),我希望它能像预期的那样工作。请提供清晰的问题陈述(您期望得到什么)和(Stackblitz等),以复制problem@Tholle函数被多次调用,所以我想防止这种情况发生。@estus函数工作正常,但它被多次触发。问题不包括这一点。多次有什么问题?这可能意味着组件行被更新,正如hook name所说。如果没有预期,考虑提供。组件中有很多方法肯定会影响它的工作方式,但没有发布。你们在这里呆了这么久,知道这里的情况是怎样的,这样的问题是无法回答的。我们应该猜测代码中发生了什么吗?(我们不应该)。