Skip to content

Instantly share code, notes, and snippets.

View kierunb's full-sized avatar
💭
Any sufficiently advanced bug is indistinguishable from a feature.

Bartek kierunb

💭
Any sufficiently advanced bug is indistinguishable from a feature.
View GitHub Profile
@kierunb
kierunb / FetchListsForWebPartPropsDropdown.ts
Created April 16, 2019 08:02 — forked from chrisobriensp/FetchListsForWebPartPropsDropdown.ts
Dynamically populate SPFX web part property dropdown list - using lists in current site. See http://cob-sp.com/SPFx-WP-Props2
/* need some imports e.g.:
import { IODataList } from '@microsoft/sp-odata-types';
import { SPHttpClient, SPHttpClientConfigurations, SPHttpClientConfiguration, SPHttpClientResponse, ODataVersion, ISPHttpClientConfiguration } from '@microsoft/sp-http';
*/
private dropdownOptions: IPropertyPaneDropdownOption[];
private listsFetched: boolean;
// these methods are split out to go step-by-step, but you could refactor and be more direct if you choose..
@kierunb
kierunb / SimpleDynamicDropdown.ts
Created April 16, 2019 07:14 — forked from chrisobriensp/SimpleDynamicDropdown.ts
Showing a simple way of populating an SPFX dropdown with code. See http://cob-sp.com/SPFx-WP-Props2
private fetchOptionsSimple(): Array<IPropertyPaneDropdownOption> {
var options: Array<IPropertyPaneDropdownOption> = new Array<IPropertyPaneDropdownOption>();
options.push( { key: 'Added1', text: 'Added from code 1' });
options.push( { key: 'Added2', text: 'Added from code 2' });
return options;
}
protected getPropertyPaneConfiguration(): IPropertyPaneConfiguration {
var fetchedOptions: Array<IPropertyPaneDropdownOption> = this.fetchOptions();