Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
And we finally edit the lifecycle handlers of the extensions to suit our needs
// imports ...
export default class CustomFormPanelCommandSet extends BaseListViewCommandSet<ICustomFormPanelCommandSetProperties> {
//...
@override
public onListViewUpdated(event: IListViewCommandSetListViewUpdatedParameters): void {
const openEditorCommand: Command = this.tryGetCommand('CMD_PANEL');
openEditorCommand.visible = event.selectedRows.length === 1;
}
@override
public onExecute(event: IListViewCommandSetExecuteEventParameters): void {
switch (event.itemId) {
case 'CMD_PANEL':
let selectedItem = event.selectedRows[0];
const listItemId = selectedItem.getValueByName('ID') as number;
const title = selectedItem.getValueByName("Title");
this._showPanel(listItemId, title);
break;
default:
throw new Error('Unknown command');
}
}
//...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment