Hello, I'm having trouble updating the popupTemplate for a Feature in the Query Widget. I've successfully modified popupTemplates before, including for the Map Widget and an earlier version of the Query Widget.
The issue isn't that I can't change the popup at all, it's specifically with the 'expression' content types not working. Other content types, like 'text', work just fine. Strangely, the same 'expression' content works perfectly in the Map Widget but fails in the Query Widget.
Does anyone know what might be causing this?
Kindly refer to the code below:
Feature element: query/src/runtime/components/feature-info.tsx
this.feature = new this.Feature({
container: container,
defaultPopupTemplateEnabled: true,
// @ts-expect-error
spatialReference: this.props.dataSource?.layer?.spatialReference || null,
// @ts-expect-error
map: rootDataSource?.map || null,
graphic: this.props.graphic,
visibleElements: this.getVisibleElements()
})
Popup Template Modification
popupTemplate.content = [
// This does not work, however works with Map Widget
{
type: 'expression',
expressionInfo: {
expression: `
var content = "<div>First test</div>";
return {
type: 'text',
text: content
};
`
}
},
// This works
{
type: "text",
text: "<div>Second test</div>"
}
]