【问题标题】:How can I make row-click independent of checkbox-selection of row in react-tabulator?如何使行单击独立于反应制表器中行的复选框选择?
【发布时间】:2019-10-10 09:01:13
【问题描述】:

我希望在单击行时选择一行并选中复选框。这些应该是相互独立的。

我尝试在选项中将行选择为 true,但想将“rowSelection”格式化程序设置更改为独立

const options = {
      height: 270,
      width:  100,
      layout:"fitColumns",
      tooltips:true,
      rowSelected:true,
      autoResize:true
    };
columns= {[
            {formatter:"rowSelection", titleFormatter:"rowSelection", align:"center", headerSort:false, cellClick:function(e, cell){
                cell.getRow().toggleSelect();
                // cell._cell.setValue(true);
                console.log("CheckboxSelection......", cell)
              }, width: 20},

【问题讨论】:

  • 很难理解您想要实现的目标。 “彼此独立”是什么意思?如果单击您的复选框,您希望行选择会发生什么?

标签: reactjs checkbox tabulator onrowclick


【解决方案1】:

如果您使用 rowSelection 格式化程序,则不需要处理 cellClick 事件,它应该为您切换选择。

如果您试图阻止 cellClick 传播到行点击,那么您应该调用 stopPropagation cellClick中的事件函数:

cellClick:function(e, cell){
    e.stopPropagation(); // prevent click event propagating up to row.
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-12-04
    • 2013-08-20
    • 2020-08-12
    • 2011-09-21
    • 2012-02-08
    • 1970-01-01
    • 2011-04-19
    相关资源
    最近更新 更多