mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-24 01:25:37 -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>();
|
||||
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) {
|
||||
if (state) {
|
||||
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 {
|
||||
return this._maximized;
|
||||
}
|
||||
@@ -343,11 +358,9 @@ class GridTable<T> extends Disposable implements IView {
|
||||
this.actionBar.push(actions, { icon: true, label: false });
|
||||
|
||||
// change actionbar on maximize change
|
||||
this.state.onMaximizedChange(e => {
|
||||
let actions = this.getCurrentActions();
|
||||
this.actionBar.clear();
|
||||
this.actionBar.push(actions, { icon: true, label: false });
|
||||
});
|
||||
this.state.onMaximizedChange(this.rebuildActionBar, this);
|
||||
|
||||
this.state.onCanBeMaximizedChange(this.rebuildActionBar, this);
|
||||
}
|
||||
|
||||
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[] {
|
||||
|
||||
let actions = [];
|
||||
|
||||
Reference in New Issue
Block a user