mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
fix grid action bar not updating (#2532)
This commit is contained in:
committed by
Karl Burtram
parent
7d898ca34d
commit
5616751c04
@@ -68,15 +68,30 @@ export class GridTableState {
|
|||||||
private _onMaximizedChange = new Emitter<boolean>();
|
private _onMaximizedChange = new Emitter<boolean>();
|
||||||
public onMaximizedChange: Event<boolean> = this._onMaximizedChange.event;
|
public onMaximizedChange: Event<boolean> = this._onMaximizedChange.event;
|
||||||
|
|
||||||
public canBeMaximized: boolean;
|
private _onCanBeMaximizedChange = new Emitter<boolean>();
|
||||||
|
public onCanBeMaximizedChange: Event<boolean> = this._onCanBeMaximizedChange.event;
|
||||||
|
|
||||||
|
private _canBeMaximized: boolean;
|
||||||
|
|
||||||
constructor(state?: IGridTableState) {
|
constructor(state?: IGridTableState) {
|
||||||
if (state) {
|
if (state) {
|
||||||
this._maximized = state.maximized;
|
this._maximized = state.maximized;
|
||||||
this.canBeMaximized = state.canBeMaximized;
|
this._canBeMaximized = state.canBeMaximized;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public get canBeMaximized(): boolean {
|
||||||
|
return this._canBeMaximized;
|
||||||
|
}
|
||||||
|
|
||||||
|
public set canBeMaximized(val: boolean) {
|
||||||
|
if (val === this._canBeMaximized) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this._canBeMaximized = val;
|
||||||
|
this._onCanBeMaximizedChange.fire(val);
|
||||||
|
}
|
||||||
|
|
||||||
public get maximized(): boolean {
|
public get maximized(): boolean {
|
||||||
return this._maximized;
|
return this._maximized;
|
||||||
}
|
}
|
||||||
@@ -343,11 +358,9 @@ class GridTable<T> extends Disposable implements IView {
|
|||||||
this.actionBar.push(actions, { icon: true, label: false });
|
this.actionBar.push(actions, { icon: true, label: false });
|
||||||
|
|
||||||
// change actionbar on maximize change
|
// change actionbar on maximize change
|
||||||
this.state.onMaximizedChange(e => {
|
this.state.onMaximizedChange(this.rebuildActionBar, this);
|
||||||
let actions = this.getCurrentActions();
|
|
||||||
this.actionBar.clear();
|
this.state.onCanBeMaximizedChange(this.rebuildActionBar, this);
|
||||||
this.actionBar.push(actions, { icon: true, label: false });
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private onTableClick(event: ITableMouseEvent) {
|
private onTableClick(event: ITableMouseEvent) {
|
||||||
@@ -377,6 +390,12 @@ class GridTable<T> extends Disposable implements IView {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private rebuildActionBar() {
|
||||||
|
let actions = this.getCurrentActions();
|
||||||
|
this.actionBar.clear();
|
||||||
|
this.actionBar.push(actions, { icon: true, label: false });
|
||||||
|
}
|
||||||
|
|
||||||
private getCurrentActions(): IAction[] {
|
private getCurrentActions(): IAction[] {
|
||||||
|
|
||||||
let actions = [];
|
let actions = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user