I tried to adapte the property pane code because I saw that buttons call render method when they are clicked.
I started like this :
let dropDownProperty : any;
switch(this.properties.source){
case 'This site':
for(var i =0; i<numberTypeOfContent;i++){
dropDownProperty = dropDownProperty,
PropertyPaneDropdown('type', {
label: 'Type',
options: [
{ key: 'Documents', text: 'Documents'},
{ key: 'Pages', text: 'Pages'},
{ key: 'News', text: 'News'},
{ key: 'Videos', text: 'Videos'},
{ key: 'Images', text: 'Images'},
{ key: 'Events', text: 'Events'},
{ key: 'Issues', text: 'Issues'},
{ key: 'Tasks', text: 'Tasks'},
{ key: 'Links', text: 'Links'},
{ key: 'Contacts', text: 'Contacts'},
{ key: 'All', text: 'All'}
],
selectedKey: 'This site'
})
}
break;
The button that I add a new dropdown look like this :
let addTypeButton = PropertyPaneButton('numberTypeOfContent',{
text: 'Add content type',
buttonType: PropertyPaneButtonType.Hero,
icon: 'Add',
onClick: this.buttonAdd.bind(this)
});
And its method:
private buttonAdd(): any {
numberTypeOfContent++;
}
Thanks in advance for your help