Skip to content

Commit 2a9391b

Browse files
Added getVisible and getDisabled support
1 parent 071d8f9 commit 2a9391b

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

controls/pcfcontroldemo/MultiSelectControl/MultiSelect.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import * as React from "react";
22
import AsyncSelect from 'react-select/async';
33

44
export interface IProps {
5+
isControlVisible: boolean;
6+
isControlDisabled: boolean;
57
displayValueField: any;
68
displayFieldLabel: any;
79
columns: any;
@@ -55,6 +57,8 @@ export class MultiSelectControl extends React.Component<IProps, IState> {
5557
{
5658
const selectStyles = { menuPortal: (zindex: any) => ({ ...zindex, zIndex: 9999}) };
5759

60+
if (this.props.isControlVisible)
61+
{
5862
return (
5963
<div>
6064
<AsyncSelect
@@ -65,8 +69,13 @@ export class MultiSelectControl extends React.Component<IProps, IState> {
6569
getOptionValue={e => e[this.props.displayValueField]}
6670
loadOptions={this.loadOptions}
6771
defaultOptions
72+
isDisabled={this.props.isControlDisabled}
6873
onChange={this.onChange}
6974
/></div>
70-
);
75+
)
76+
}
77+
else{
78+
return (<></>);
79+
};
7180
}
7281
}

controls/pcfcontroldemo/MultiSelectControl/index.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ export class MultiSelectPCFControl implements ComponentFramework.StandardControl
1919
columns: "",
2020
topCount: "",
2121
filterField: "",
22-
entityName: ""
22+
entityName: "",
23+
isControlVisible: true,
24+
isControlDisabled: true
2325
};
2426
private _context: ComponentFramework.Context<IInputs>;
2527

@@ -77,6 +79,9 @@ export class MultiSelectPCFControl implements ComponentFramework.StandardControl
7779

7880
private renderElement()
7981
{
82+
this.props.isControlDisabled = this._context.mode.isControlDisabled;
83+
this.props.isControlVisible = this._context.mode.isVisible;
84+
8085
ReactDOM.render(
8186
React.createElement(MultiSelectControl, this.props)
8287
, this._container

0 commit comments

Comments
 (0)