rez-table-listing-mui
Version:
A rez table listing component built on TanStack Table
80 lines (76 loc) • 2.26 kB
text/typescript
export const generateTableData = () => {
const records = [];
// Adding a few specific records
records.push(
{
id: 1,
name: "Employee 1",
department: "Marketing",
position: "Senior Manager",
email: "employee1@example.com",
phone: "+1-202-555-0101",
dateOfJoining: "2018-05-21",
salary: 75000,
performanceRating: "A",
location: "New York",
status: "Active",
},
{
id: 2,
name: "Employee 2",
department: "Finance",
position: "Accountant",
email: "employee2@example.com",
phone: "+1-202-555-0112",
dateOfJoining: "2020-09-15",
salary: 60000,
performanceRating: "B",
location: "Chicago",
status: "Inactive",
},
{
id: 3,
name: "Employee 3",
department: "HR",
position: "HR Specialist",
email: "employee3@example.com",
phone: "+1-202-555-0133",
dateOfJoining: "2017-03-12",
salary: 58000,
performanceRating: "A",
location: "Boston",
status: "Pending",
}
);
// Adding dynamically generated records for variety
for (let i = 4; i <= 200; i++) {
records.push({
id: i,
name: `Employee ${i}`,
department: ["IT", "Marketing", "Finance", "HR", "Operations"][
Math.floor(Math.random() * 5)
],
position: ["Specialist", "Manager", "Analyst", "Consultant", "Director"][
Math.floor(Math.random() * 5)
],
email: `employee${i}@example.com`,
phone: `+1-202-555-${(i + 10).toString().padStart(4, "0")}`,
dateOfJoining: new Date(
2015 + Math.floor(Math.random() * 8),
Math.floor(Math.random() * 12),
Math.floor(Math.random() * 28) + 1
)
.toISOString()
.split("T")[0],
salary: Math.floor(Math.random() * 40000) + 50000,
performanceRating: ["A", "B", "C"][Math.floor(Math.random() * 3)],
location: ["New York", "Chicago", "Boston", "Seattle", "Austin"][
Math.floor(Math.random() * 5)
],
status: ["Active", "Inactive", "Pending", "Hold"][
Math.floor(Math.random() * 4)
],
});
}
return records;
};