Skip to content

Instantly share code, notes, and snippets.

@glennswest
Created April 1, 2022 23:13
Show Gist options
  • Save glennswest/387af6caea9b96668ad9ecc14ffd9345 to your computer and use it in GitHub Desktop.
Save glennswest/387af6caea9b96668ad9ecc14ffd9345 to your computer and use it in GitHub Desktop.
Post to update data in tabulator
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tabulator Example</title>
<link href="tabulator.min.css" rel="stylesheet">
<script type="text/javascript" src="tabulator.min.js"></script>
</head>
<body>
<div id="SystemSettings"></div>
<script type="text/javascript">
var table = new Tabulator("#SystemSettings", {
height: 220,
ajaxURL: "data/systemsetting.json",
columns: [
{title: "Name",field: "name",width: 150},
{title: "Value",field: "val",editor:"input",width: 150}
],
});
table.on('cellEdited', function(cell){
// This callback is called any time a cell is edited.
var xdata = cell.getData();
ajaxConfig:"POST"
var ajaxConfig = {
method:"post" //set request type to Position
};
table.setData("data/systemsetting.json?update",xdata,ajaxConfig);
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment