Help making Popup Template load synchronously or delay it.

527
0
11-07-2019 05:35 AM
AshleyOng
New Contributor

Hi everyone,

Is there a way to delay or make the popup template load synchronously? Currently when I click on a feature on my map, the template loads as expected. In my customLandPopup, there is an Arcade expression that I am using to populate one of my fields.

var myLayers = new MapImageLayer({
    url: 'https:sample/MapServer/',
    sublayers: [
        {
            id: 5,
            visible: true,
            title: 'Land',
            popupTemplate: customLandPopup
        },‍‍‍‍‍‍‍‍
    ]
});‍‍‍‍‍‍‍‍‍‍‍

For the very first click (#1) to query, let's say it returned 5 features. In the popup for the first feature, the expression will throw an error, and there will be a blank in the table: 

[esri.widgets.FeatureViewModel] query-required-fields Could not query required fields for the specified layer. Some fields will not be available.

[esri.widgets.FeatureViewModel] arcade-execution-error TypeError: Cannot read property 'length' of undefined.

For the subsequent 4 features, that same field will be correctly populated from the arcade expression. Is it possible that this is due to an asynchronous loading of the features while the popup is being opened? 

Thanks for any advice on this.

0 Kudos
0 Replies