cellEdited 在版本 5.0.7 中不触发

cellEdited not triggering in version 5.0.7

我无法在 5.0 或更高版本中触发 cellEdited - 它在 4.9 中有效,但在 v5.+

中无效

我通读了升级文档,但没有看到此功能可能发生的任何更改。

这是一个小例子,说明以前有效但不再有效的方法。

提前致谢。

<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <link href="https://unpkg.com/tabulator-tables@5.0.7/dist/css/tabulator.min.css" rel="stylesheet">
  <script type="text/javascript" src="https://unpkg.com/tabulator-tables@5.0/dist/js/tabulator.min.js"></script>
</head>

<body>
  <div id="example-table"></div>
</body>
<script>
  var tabledata = [{
    id: 1,
    name: "Oli Bob"
  }, ];

  //Build Tabulator
  var table = new Tabulator("#example-table", {
    height: "311px",
    columns: [{
      title: "Name",
      field: "name",
      width: 150,
      editor: "input",
      cellEdited: (cell) => (console.log('edited'))
    }, ],
    data: tabledata
  });
</script>

</html>

从 V5.0 开始,大多数回调现在已被事件取代。尝试使用:

table.on('cellEdited', () => {
  //do something
})

这是一个例子:

<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <link href="https://unpkg.com/tabulator-tables@5.0.7/dist/css/tabulator.min.css" rel="stylesheet">
  <script type="text/javascript" src="https://unpkg.com/tabulator-tables@5.0/dist/js/tabulator.min.js"></script>
</head>

<body>
  <div id="example-table"></div>
</body>
<script>
  var tabledata = [{
    id: 1,
    name: "Oli Bob"
  }, ];

  //Build Tabulator
  var table = new Tabulator("#example-table", {
    height: "311px",
    columns: [{
      title: "Name",
      field: "name",
      width: 150,
      editor: "input"
    }],
    data: tabledata
  });

  table.on('cellEdited', (cell) => {
    console.log('edited')
  })
</script>

</html>