1
0
mirror of synced 2025-12-22 19:34:15 -05:00

Add a cool table component

This commit is contained in:
Chiedo
2020-10-18 17:35:50 -04:00
parent b781e43893
commit 797adb1a0d
7 changed files with 518 additions and 13 deletions

40
react/CoolTable.js Normal file
View File

@@ -0,0 +1,40 @@
const React = require('react')
const ReactDOM = require('react-dom')
const MUIDataTable = require("mui-datatables").default;
const columns = ["Name", "Company", "City", "State"];
const data = [
["Joe James", "Test Corp", "Yonkers", "NY"],
["John Walsh", "Test Corp", "Hartford", "CT"],
["Bob Herm", "Test Corp", "Tampa", "FL"],
["James Houston", "Test Corp", "Dallas", "TX"],
];
const options = {
filterType: 'checkbox',
};
const CoolTable = function () {
return (
<MUIDataTable
title={"Employee List"}
data={data}
columns={columns}
options={options}
/>
)
}
if (typeof window === 'undefined') {
} else {
const componentContainers = document.querySelectorAll('.react-component-CoolTable')
for (const componentContainer of componentContainers) {
ReactDOM.render(React.createElement(CoolTable, {}, componentContainer.children[0].innerText), componentContainer)
}
}
module.exports = CoolTable