Its mainly used to generate the dynamic table based on the array of objects
Just import the package and get the random text color
Run this command on your terminal:
npm install rvm-dynamic-table-creation
Then you can import it into your project like this :
import 'rvm-dynamic-table-creation';
use it in your html file
<dynamic-table id="tblDynamicTable"></dynamic-table>
<script type="module" src="path/to/your-component.js"></script>
Then you should assign the array of object with dynamic table custom element attribute like below
IIFE (Immediate Invoke Functino Expression):
No need to call this function when the page load this function trigger automaticaly.
(function () {
let tableObject = [
{
userId: 1,
id: 1,
title: "delectus aut autem",
completed: false,
},
{
userId: 2,
id: 2,
title: "dsfdg delectus aut autem",
completed: true,
},
{
userId: 3,
id: 3,
title: "ghghh dsfdg delectus aut autem",
completed: true,
},
];
document.getElementById("tblDynamicTable").setAttribute("tabledata",JSON.stringify(tableObject))
})();
If you want you can customise the table style using customstyle attribute
R Marimuthu