Created
July 2, 2017 12:50
-
-
Save estruyf/99b177cbdfd53237beb37649719dca78 to your computer and use it in GitHub Desktop.
SharePoint Framework ListView Command Set Extension - get selected items
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
@override | |
public onExecute(event: IListViewCommandSetExecuteEventParameters): void { | |
switch (event.commandId) { | |
case 'COMMAND_1': | |
// Check if the user selected some items | |
if (event.selectedRows.length > 0) { | |
// Check the selected rows | |
event.selectedRows.forEach((row: RowAccessor, index: number) => { | |
alert(`Field ID: ${row.getValueByName('ID')} - Field title: ${row.getValueByName('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