I am building an angular app that the majority of the data is displayed in grid view. I want to build a reusable dynamic grid component that takes a config json object and build a new instance of it based on the config data.
For example:
If I want to implement two new grids (Users Grid and Report Grid) where each grid has different rows and cols. And both of them use the dynamicGrid component.
My question: for performance wise, is it better to store the config data of the grids in the database or hardcode them in a .ts file as objects?
something like that:
export const gridUserConfig:TableBasicConfig = {
colsLength: 7,
rowsLength: 100,
pagination: true,
rowsPerPage: [5, 10, 15, 50, 100, 200],
defaultRowsPerPage: 10,
style: {
tableSizeClass: 'p-datatable-sm',
gridLinesClass: 'p-datatable-gridlines',
striped: 'p-datatable-striped'
},
header: {
displayHeader: true,
title: {
displayTitle: true,
text: 'User Grid'
},
caption: {
displayCaption: true
}
},
footer: {
displayFooter: false
},
rawData: this.getUsers()
}
TheTableBasicConfig
is an interface where the structure and keys of the response are specified.