1.0.11 • Published 5 years ago
ob-datatable-dev v1.0.11
ob-datatable - Material-UI Datatable
Dependencies
npm install @material-ui/core @material-ui/icons
Set the local npm registry
npm config set registry https://npm-registry.myopenbee.com/
Install
npm install ob-datatable
Usage
For a simple table:
import ob-datatable from "ob-datatable";
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',
};
<ob-datatables
title={"Employee List"}
data={data}
columns={columns}
options={options}
/>
Or customize columns:
import ob-datatables from "ob-datatable";
const columns = [
{
name: "name",
label: "Name",
options: {
filter: true,
sort: true,
}
},
{
name: "company",
label: "Company",
options: {
filter: true,
sort: false,
}
},
{
name: "city",
label: "City",
options: {
filter: true,
sort: false,
}
},
{
name: "state",
label: "State",
options: {
filter: true,
sort: false,
}
},
];
const data = [
{ name: "Joe James", company: "Test Corp", city: "Yonkers", state: "NY" },
{ name: "John Walsh", company: "Test Corp", city: "Hartford", state: "CT" },
{ name: "Bob Herm", company: "Test Corp", city: "Tampa", state: "FL" },
{ name: "James Houston", company: "Test Corp", city: "Dallas", state: "TX" },
];
const options = {
filterType: 'checkbox',
};
<ob-datatable
title={"Employee List"}
data={data}
columns={columns}
options={options}
/>