Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/466.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 排除行事件中的单个列_Javascript_Reactjs - Fatal编程技术网

Javascript 排除行事件中的单个列

Javascript 排除行事件中的单个列,javascript,reactjs,Javascript,Reactjs,我正在使用React-Bootstrap-Table-2并使用它们的rowEvents函数使行可以单击转到另一个页面。但是,我需要从该行事件中排除其中一列,因为它有一个“status”开关,并且onClick函数优先于该开关,所以我不能再切换它 我尝试过使用columnIndex,但我不确定如何实现它以从row事件中删除。示例:我有五列,我只希望行事件跨越其中的4列,而不是最后一列 const rowEvents = { onClick: (e, row, rowIndex) =

我正在使用React-Bootstrap-Table-2并使用它们的rowEvents函数使行可以单击转到另一个页面。但是,我需要从该行事件中排除其中一列,因为它有一个“status”开关,并且onClick函数优先于该开关,所以我不能再切换它

我尝试过使用columnIndex,但我不确定如何实现它以从row事件中删除。示例:我有五列,我只希望行事件跨越其中的4列,而不是最后一列

  const rowEvents = {
      onClick: (e, row, rowIndex) => {
        this.handleOfferSelection(row);
      },
      onMouseEnter: (e, row, rowIndex) => {
        this.setState({ activeRow: rowIndex });
      }
    };

// Table
    <BootstrapTable
                      {...props.baseProps}
                      pagination={paginationFactory()}
                      rowEvents={rowEvents}
                      rowStyle={rowStyle}
                    />
const行事件={
onClick:(e,行,行索引)=>{
本.handleOfferSelection(世界其他地区);
},
onMouseCenter:(e,行,行索引)=>{
this.setState({activeRow:rowIndex});
}
};
//桌子
我只需要将最后一列从行事件中完全排除

onClick: (e, row, rowIndex) => {
    let getCurrentCellIndex = e.target.cellIndex;
    let getLastCellIndex = document.querySelector('table tr:last-child td:last-child').cellIndex
      // As this event is for the hole ROW, we need to exclude last one, as we have different events there. You can exclude no matter which one, even pass it as parameter.

      if (getCurrentCellIndex !== getLastCellIndex && getCurrentCellIndex !== undefined) {
        console.log(`----> ${JSON.stringify(row)} |||| ${rowIndex}`)
      }
}