This commit is contained in:
Chris Kruining 2024-12-12 16:40:13 +01:00
parent d219ae1f9a
commit b23db1d5a8
No known key found for this signature in database
GPG key ID: EB894A3560CCCAD2
21 changed files with 579 additions and 818 deletions

View file

@ -105,6 +105,10 @@ export const Grid: Component<{ class?: string, columns: string[], rows: Rows, ap
},
addColumn(name: string): void {
if (state.columns.includes(name)) {
return;
}
setState(produce(state => {
state.columns.push(name);
state.rows = Object.fromEntries(Object.entries(state.rows).map(([key, row]) => [key, { ...row, [name]: '' }]));
@ -155,7 +159,6 @@ const Api: Component<{ api: undefined | ((api: GridApi) => any), table?: any }>
insert(prop: string) {
gridContext.insert(prop);
},
addColumn(name: string): void {
gridContext.addColumn(name);
},