mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-18 09:35:39 -05:00
allow extension to select row in declarative table (#15703)
* allow extension to select row in declarative table * pr comments * use proper type for the event. * update event arg
This commit is contained in:
@@ -1544,7 +1544,7 @@ class DeclarativeTableWrapper extends ComponentWrapper implements azdata.Declara
|
||||
super(proxy, handle, ModelComponentTypes.DeclarativeTable, id, logService);
|
||||
this.properties = {};
|
||||
this._emitterMap.set(ComponentEventType.onDidChange, new Emitter<any>());
|
||||
this._emitterMap.set(ComponentEventType.onDidClick, new Emitter<any>());
|
||||
this._emitterMap.set(ComponentEventType.onSelectedRowChanged, new Emitter<azdata.DeclarativeTableRowSelectedEvent>());
|
||||
|
||||
}
|
||||
|
||||
@@ -1581,8 +1581,8 @@ class DeclarativeTableWrapper extends ComponentWrapper implements azdata.Declara
|
||||
return emitter && emitter.event;
|
||||
}
|
||||
|
||||
public get onRowSelected(): vscode.Event<any> {
|
||||
let emitter = this._emitterMap.get(ComponentEventType.onDidClick);
|
||||
public get onRowSelected(): vscode.Event<azdata.DeclarativeTableRowSelectedEvent> {
|
||||
let emitter = this._emitterMap.get(ComponentEventType.onSelectedRowChanged);
|
||||
return emitter && emitter.event;
|
||||
}
|
||||
|
||||
@@ -1602,6 +1602,14 @@ class DeclarativeTableWrapper extends ComponentWrapper implements azdata.Declara
|
||||
this._proxy.$doAction(this._handle, this._id, ModelViewAction.Filter, rowIndexes);
|
||||
}
|
||||
|
||||
public get selectedRow(): number {
|
||||
return this.properties['selectedRow'] ?? -1;
|
||||
}
|
||||
|
||||
public set selectedRow(v: number) {
|
||||
this.setProperty('selectedRow', v);
|
||||
}
|
||||
|
||||
public toComponentShape(): IComponentShape {
|
||||
// Overridden to ensure we send the correct properties mapping.
|
||||
return <IComponentShape>{
|
||||
|
||||
Reference in New Issue
Block a user