Delving into Dynamic HTML table creation, I'm currently using jquery
for rendering purposes. At the moment, I am only displaying the table.
The Goal
- I aim to segment my table into four columns or a grid structure
- Something akin to this:
https://i.stack.imgur.com/FVbQp.png
- However, I'm stumped on how to proceed with this task
var tableValue = [{
"Item Name": "CHICKEN BURGER PACKED ",
"TO Qty": "4.0000"
}, ... // (Data truncated for brevity)
function addTable(tableValue) {
var $tbl = $("<table />", {
"class": "table table-striped table-bordered table-hover "
}),
$tb = $("<tbody/>"),
$trh = $("<tr/>");
// JavaScript function for generating table rows and cells
$tbl.append($tb);
$("#DisplayTable").html($tbl);
}
addTable(tableValue)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> ... // (JS imports)
<div align="center">
<table id="DisplayTable">
</table>
</div>
I'm seeking guidance on splitting my table into four columns or grids effectively.
Edit
The specific requirement is to set a height limit for the table such that once the first column reaches that height threshold, the subsequent items would flow into a new column automatically.