An open-source lightweight JavaScript grid framework that allows you to create fast and easy-to-use data grids in your web application. It supports virtual scrolling, custom column headers, and context menus.
<head>
<link rel="stylesheet" href="https://unpkg.com/opengridjs/opengridjs.css">
<script src="https://unpkg.com/opengridjs/opengridjs.js"></script>
</head>
<body>
<div class="grid"></div>
<script>
const setup = {
columnHeaderNames: [
{
columnName: "name",
columnNameDisplay: "Full Name",
},
{ columnName: "phoneNumber" },
],
contextMenuTitle: "Context Title",
contextMenuOptions: [
{
actionName: "Example",
actionFunctionName: "exampleRow",
className: "example-row",
},
],
};
fetch("https://lumabyte.com/api/generateMockRandomPeople?count=1000")
.then((response) => response.json())
.then((data) => {
initGrid(data);
});
function initGrid(data) {
var grid = new Opengridjs("grid", data, 350, setup);
}
function exampleRow(row) {
alert("Example row " + row.email);
}
</script>
</body>