I am creating an admin panel which is a big project & contains a lot of tables. after creating few tables I have noticed that I am repeating my table code & then I thought of creating my custom table component. as you read my question title I Don't want to use a package, I want to create my own.
My all tables have few same repeated columns like id, Status, Action Buttons (CRUD Buttons).
- I have Lot of Tables.
- Keys and Values should be dynamic.
I was able to render table data, But having problems while rendering status & action columns.
This is the React Js Code.
<div className="app-wrapper">
<DataTable headings={headings} rows={userData} />
</div>
This is the dummy API data for your reference. KEYS & Values will be different for each table (Obviosly)
[
{
"title": "Data fetched successfully",
"error": false,
"total": 5,
"ListData": [
{
"Id": "2229FD72-3D74-41B7-BBC4-ECBFFCC75709",
"UserTypeStatus": 1,
"UserTypeName": "Payroll",
"UserTypeShortName": "PR",
"UserTypeHierarchyOrder": 5
},
{
"Id": "16184F43-3789-44AC-BB73-C07693533D7E",
"UserTypeStatus": 1,
"UserTypeName": "Rahul Payroll",
"UserTypeShortName": "PR",
"UserTypeHierarchyOrder": 6
},
{
"Id": "19B923A8-88DE-48B5-BD1A-77AC25B41B34",
"UserTypeStatus": 1,
"UserTypeName": "User",
"UserTypeShortName": "UR",
"UserTypeHierarchyOrder": 7
},
{
"Id": "8BB60DCB-B3E3-4EF0-8602-F27579FF855A",
"UserTypeStatus": 1,
"UserTypeName": "Developer",
"UserTypeShortName": "DP",
"UserTypeHierarchyOrder": 8
},
{
"Id": "6BDFA417-0658-451A-BFB2-B5002828A1D9",
"UserTypeStatus": 1,
"UserTypeName": "Admin",
"UserTypeShortName": "AD",
"UserTypeHierarchyOrder": 9999
}
]
}
]