HTML and Javascript code
<h4>1. Preconfigured table</h4>
<div id="carsTable"></div>
<script type="text/javascript">
// Execute on page load
$(function () {
var contentArray = [
["Year", "Ford", "Volvo", "Toyota", "Honda", "Remark"],
["2014", 10, 11, 12, 13, '-'],
["2015", 20, 11, 14, 13, "Boston's figures"],
["2016", 30, 15, 12, 13, 'Checked: "7"']
];
$('#carsTable').flextabledit({
content: contentArray,
addTableClass: "myTable"
});
});
</script>
You only must define a container <div>
at the location in your html where you want to show the table.
Then, use javascript to construct the flextabledit plugin for this element.
Styling
In this example some extra styling is applied to the table in order to set its background color and to apply table and cell borders. This looks as follows:
<style>
.myTable {
border-collapse: collapse;
border-spacing: 0;
margin-top: 0.8333em;
margin-bottom: 30px;
width: 100%;
background: #f4f6f5;
}
.myTable th:first-child,
.myTable td:first-child {
width: 32px;
text-align: center;
}
.myTable th,
.myTable td {
border: 1px solid #b3bcba;
}
</style>