Hello,
I'm working with a Feature widget in a TypeScript project and encountering an issue when trying to access the title property of the widget. Despite the widget being initialized and seemingly working fine, attempting to access/log the title property results in an empty string.
Here's a simplified version of my code:
import Feature from '@arcgis/core/widgets/Feature';
function initializeFeatureWidget(view: MapView, unFeature: Graphic) {
// Assuming 'view' and 'unFeature' are already defined and valid
const container = document.createElement('div');
container.setAttribute('id', 'feature-widget');
document.body.appendChild(container); // Simplified for this example
const featureWidget = new Feature({
graphic: unFeature,
container: 'feature-widget',
map: view.map,
spatialReference: view.spatialReference
});
console.log(featureWidget); // Logs the instance with set "title" property inside
console.log(featureWidget.title); // Logs an empty string
}
I am building my own version of the popup and I need that Feature widget for the feature's info. I expected to access the title of the feature widget and display it in the header of that custom popup, but it doesn't seem to work as anticipated. The rest of the widget functionality seems to be unaffected.
I followed up the docs Feature | API Reference | ArcGIS Maps SDK for JavaScript 4.30 | Esri Developer and to my understating it should work just fine.
Has anyone encountered this issue before, or does anyone have insights on what might be going wrong? Any advice on how to properly access the title property of a Feature widget would be greatly appreciated.
Thank you in advance for your help!
Bartosz