Widget Setting Function returns null for props.useMapWidgetIds

652
2
Jump to solution
01-26-2023 02:27 AM
Gurunara
New Contributor III

Trying to create settings.tsx for Experience Builder Widget version 1.10.

Using function syntax:

export default function Setting(props: AllWidgetSettingProps<IMConfig>){
...

However props.useMapWidgetIds, which should contain list of maps on the current page, is null.

In version 1.05 function syntax works, and props.useMapWidgetIds is not null.

Also in 1.10 if use class syntax, 

export default class Setting extends React.PureComponent<
AllWidgetSettingProps<IMConfig>,
any
> {
...

then this.props.useMapWidgetIds is not null/undefined.

0 Kudos
2 Solutions

Accepted Solutions
Gurunara
New Contributor III

Worked after changing:
<JimuMapViewSelector
onChange={onMapWidgetSelected}
useMapViewIds={props.useMapWidgetIds?.asMutable()}
/>

to

<MapWidgetSelector
onSelect={onMapWidgetSelected}
useMapWidgetIds={props.useMapWidgetIds}
/>

Actually props.useMapWidgetIds still appeared to be undefined when debugging... but the Select Map widget section of the settings populated with the map(s) on the page with the latter option.

 

View solution in original post

0 Kudos
Gurunara
New Contributor III

Worked after changing:
<JimuMapViewSelector
onChange={onMapWidgetSelected}
useMapViewIds={props.useMapWidgetIds?.asMutable()}
/>

to

<MapWidgetSelector
onSelect={onMapWidgetSelected}
useMapWidgetIds={props.useMapWidgetIds}
/>

Actually props.useMapWidgetIds still appeared to be undefined when debugging... but the Select Map widget section of the settings populated with the map(s) on the page with the latter option.

View solution in original post

0 Kudos
2 Replies
Gurunara
New Contributor III

Worked after changing:
<JimuMapViewSelector
onChange={onMapWidgetSelected}
useMapViewIds={props.useMapWidgetIds?.asMutable()}
/>

to

<MapWidgetSelector
onSelect={onMapWidgetSelected}
useMapWidgetIds={props.useMapWidgetIds}
/>

Actually props.useMapWidgetIds still appeared to be undefined when debugging... but the Select Map widget section of the settings populated with the map(s) on the page with the latter option.

 

0 Kudos
Gurunara
New Contributor III

Worked after changing:
<JimuMapViewSelector
onChange={onMapWidgetSelected}
useMapViewIds={props.useMapWidgetIds?.asMutable()}
/>

to

<MapWidgetSelector
onSelect={onMapWidgetSelected}
useMapWidgetIds={props.useMapWidgetIds}
/>

Actually props.useMapWidgetIds still appeared to be undefined when debugging... but the Select Map widget section of the settings populated with the map(s) on the page with the latter option.

0 Kudos