Reputation: 43
I can't get cellEdited
to trigger in version 5.0 or greater - it did in 4.9 and does not work in v5.+
I read through the upgrade docs, but didn't see anything that might have changed for this feature.
Here is a small example of what worked before but no longer works.
Thanks in advance.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link href="https://unpkg.com/[email protected]/dist/css/tabulator.min.css" rel="stylesheet">
<script type="text/javascript" src="https://unpkg.com/[email protected]/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>
Upvotes: 4
Views: 794
Reputation: 2287
Starting with V5.0, most callbacks have now been replaced with events. Try using:
table.on('cellEdited', () => {
//do something
})
Here is an example:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<link href="https://unpkg.com/[email protected]/dist/css/tabulator.min.css" rel="stylesheet">
<script type="text/javascript" src="https://unpkg.com/[email protected]/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>
Upvotes: 3