@skoofy5 - Thanks for the reply! When I try the following in a form "onLoad" script with my custom PCF I get an error: "TypeError: control.removeOption is not a function"
let control = this._formContext.getControl("mrs_legs"); // My custom PCF control
control.removeOption(123); // Throws the exception: TypeError: control.removeOption is not a function
If I change the control back to the default then I don't receive that error.
My control is very basic at this point but here it is:
import * as React from "react";
import * as ReactDOM from 'react-dom';
import AdvancedMultiSelectControl, { IAdvancedMultiSelectProps } from "./AdvancedMultiSelectControl";
import { IInputs, IOutputs } from "./generated/ManifestTypes";
interface IAdvancedMultiSelectState extends ComponentFramework.Dictionary {
}
export class AdvancedMultiSelect implements ComponentFramework.StandardControl<IInputs, IOutputs> {
_container: HTMLDivElement;
_initialVisible: boolean;
_initialDisabled: boolean;
_optionSetMetadata: ComponentFramework.PropertyHelper.FieldPropertyMetadata.OptionSetMetadata;
constructor() {
}
public init(
context: ComponentFramework.Context<IInputs>,
notifyOutputChanged: () => void,
state: IAdvancedMultiSelectState,
container: HTMLDivElement): void {
this._container = container;
this._initialVisible = context.mode.isVisible;
this._initialDisabled = context.mode.isControlDisabled;
this._optionSetMetadata = context.parameters.controlProps.attributes!;
}
public updateView(context: ComponentFramework.Context<IInputs>): void {
ReactDOM.render(React.createElement(AdvancedMultiSelectControl,
{
values: [],
} as IAdvancedMultiSelectProps),
this._container);
}
public getOutputs(): IOutputs {
return {};
}
public destroy = (): void => {}
public clearOptions = () => {
alert("Clear options");
}
public getOptions = () => {
alert("Get options called");
}
public removeOption = (option: number) => {
alert("Remove option");
}
public addOption = (option: number) => {
alert("addOption");
}
}
Are you able to share the code from your control? I must just be not understanding something correctly. Thanks!