I'm working with the RC0 version of spfx and am having trouble selecting a default dropdown option.
I'm using the selectedKey property that I found in the documentation here. I have used both text and integer keys.
PropertyPaneDropdown('test2', {
label: 'Dropdown',
options: [
{ key: '1', text: 'One'},
{ key: '2', text: 'Two' },
{ key: '3', text: 'Three' },
{ key: '4', text: 'Four'}
],
selectedKey: '4',
})
When I inspect the react state and props on initial render here is what I get. Notice selectedKey is not present.
After I select an option selectedKey and selectedIndex appear and are changed respectively.
EDIT FYI
I also tried the method that Chris O'Brian used here that involves setting the default like so...
PropertyPaneDropdown('dropdownProperty', {
label: 'This is the label',
isDisabled: false,
options: [
{ key: 'Red', text: 'Red' },
{ key: 'Green', text: 'Green' },
{ key: 'DarkBlue', text: 'Dark blue', **isSelected: true** }
]
})
This method wouldn't even transpile the typescript.