mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-25 01:25:36 -05:00
Add optional title to tables (#6740)
* Add optional title to tables * addressing comments
This commit is contained in:
1
src/sql/azdata.d.ts
vendored
1
src/sql/azdata.d.ts
vendored
@@ -3239,6 +3239,7 @@ declare module 'azdata' {
|
||||
fontSize?: number | string;
|
||||
selectedRows?: number[];
|
||||
forceFitColumns?: ColumnSizingMode;
|
||||
title?: string;
|
||||
}
|
||||
|
||||
export interface FileBrowserTreeProperties extends ComponentProperties {
|
||||
|
||||
@@ -339,4 +339,8 @@ export class Table<T extends Slick.SlickData> extends Widget implements IDisposa
|
||||
this._grid.setOptions(newOptions);
|
||||
this._grid.invalidate();
|
||||
}
|
||||
|
||||
public setTableTitle(title: string): void {
|
||||
this._tableContainer.title = title;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1133,6 +1133,13 @@ class TableComponentWrapper extends ComponentWrapper implements azdata.TableComp
|
||||
this.setProperty('forceFitColumns', v);
|
||||
}
|
||||
|
||||
public get title(): string {
|
||||
return this.properties['title'];
|
||||
}
|
||||
public set title(v: string) {
|
||||
this.setProperty('title', v);
|
||||
}
|
||||
|
||||
public get onRowSelected(): vscode.Event<any> {
|
||||
let emitter = this._emitterMap.get(ComponentEventType.onSelectedRowChanged);
|
||||
return emitter && emitter.event;
|
||||
|
||||
@@ -208,6 +208,7 @@ export default class TableComponent extends ComponentBase implements IComponent,
|
||||
this._tableColumns = this.transformColumns(this.columns);
|
||||
this._table.columns = this._tableColumns;
|
||||
this._table.setData(this._tableData);
|
||||
this._table.setTableTitle(this.title);
|
||||
if (this.selectedRows) {
|
||||
this._table.setSelectedRows(this.selectedRows);
|
||||
}
|
||||
@@ -286,4 +287,8 @@ export default class TableComponent extends ComponentBase implements IComponent,
|
||||
public get forceFitColumns() {
|
||||
return this.getPropertyOrDefault<azdata.TableComponentProperties, ColumnSizingMode>((props) => props.forceFitColumns, ColumnSizingMode.ForceFit);
|
||||
}
|
||||
|
||||
public get title() {
|
||||
return this.getPropertyOrDefault<azdata.TableComponentProperties, string>((props) => props.title, '');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user