mirror of
https://github.com/dbgate/dbgate
synced 2024-11-07 20:26:23 +00:00
custom grid
This commit is contained in:
parent
ef77dbf768
commit
4864a376c6
@ -16,6 +16,7 @@ import { Expression, Select, treeToSql, dumpSqlSelect, ColumnRefExpression } fro
|
|||||||
export interface CustomGridColumn {
|
export interface CustomGridColumn {
|
||||||
columnName: string;
|
columnName: string;
|
||||||
columnLabel: string;
|
columnLabel: string;
|
||||||
|
isPrimaryKey?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CustomGridDisplay extends GridDisplay {
|
export class CustomGridDisplay extends GridDisplay {
|
||||||
@ -38,14 +39,22 @@ export class CustomGridDisplay extends GridDisplay {
|
|||||||
headerText: col.columnLabel,
|
headerText: col.columnLabel,
|
||||||
uniqueName: col.columnName,
|
uniqueName: col.columnName,
|
||||||
uniquePath: [col.columnName],
|
uniquePath: [col.columnName],
|
||||||
isPrimaryKey: false,
|
isPrimaryKey: col.isPrimaryKey,
|
||||||
isForeignKeyUnique: false,
|
isForeignKeyUnique: false,
|
||||||
schemaName: tableName.schemaName,
|
schemaName: tableName.schemaName,
|
||||||
pureName: tableName.pureName,
|
pureName: tableName.pureName,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
this.changeSetKeyFields = columns.filter(x => x.isPrimaryKey).map(x => x.columnName);
|
||||||
|
this.baseTable = {
|
||||||
|
...tableName,
|
||||||
|
columns: this.columns.map(x => ({ ...tableName, columnName: x.columnName, dataType: 'string' })),
|
||||||
|
foreignKeys: [],
|
||||||
|
};
|
||||||
|
|
||||||
this.filterable = true;
|
this.filterable = true;
|
||||||
this.sortable = true;
|
this.sortable = true;
|
||||||
this.groupable = true;
|
this.groupable = false;
|
||||||
this.editable = !isReadOnly;
|
this.editable = !isReadOnly;
|
||||||
this.supportsReload = true;
|
this.supportsReload = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user