And we finally edit the lifecycle handlers of the extensions to suit our needs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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