PopupTemplate breaking changes in panels loading from API 4.4 and 4.17

3438
5
Jump to solution
04-09-2021 08:19 AM
ChristopheS
New Contributor II

Hi All,

I have noticed a very annoying problem for us.

In version 4.4 PopupTemplate with content function property use to display its panels "on demand".

Which means that panels where only queried when user was clicking on the next feature of the popup.

Now that we use 4.17 API, the issue is that the content panels are loaded once in a row for all panel features. Which can lead to a very big amount of data that has to be loaded and not useful.

You can see this difference in sample :

https://developers.arcgis.com/javascript/latest/sample-code/sandbox/index.html?sample=popuptemplate-...

just change the API version from "<script src="https://js.arcgis.com/4.4/"></script>" to "<script src="https://js.arcgis.com/4.18/"></script>" and we can see that function "queryChargingStations()" is called on demand displayed panel in old 4.4 version, but for version 4.17, it is called on each features at the creation of the popup even though related panels are not displayed.

(To see that just put an alert"Panel now loading"); in the beginning of function queryChargingStations)

This leads for us to a huge data loading and causes issues.

Is there a way for content function to be called at feature's panel display time instead of all features in a row ?

Beast Regards , Christophe

0 Kudos
1 Solution

Accepted Solutions
UndralBatsukh
Esri Regular Contributor

Hi there, 

It is fixed to 20 features at 4.19. I have created an enhancement request for this to be able to adjust this number. I will update you when this is installed. 

 

-Undral

View solution in original post

5 Replies
UndralBatsukh
Esri Regular Contributor

Hi there,

We changed the  behavior you described at 4.19 to fetch 20 features at a time for a popup.  So the performance will be better if you upgrade to 4.19.  4.19 will be released at the end of April. You can already test your app by pointing to next version as shown below:

<link rel="stylesheet" href="https://js.arcgis.com/next/esri/themes/light/main.css"/>
<script src="https://js.arcgis.com/next/"></script>

Hope this helps,

-Undral

0 Kudos
ChristopheS
New Contributor II

Hello Undral, thank you for answering.

Is there, or will there be a way to adjust this 20 read-ahead features, as a parameter ? Or is it definitely fixed to 20 ?

As our process that loads popup is quiet heavy, we must call popup dialog filling one by one.

Regards

0 Kudos
UndralBatsukh
Esri Regular Contributor

Hi there, 

I want to give you a quick update on this issue. At version 4.20, we added a new property called `featurePerPage` on popupViewModel.

The version 4.20 will be released late June 2021. But you can test this property on our `next` version. You can see this property in action in this test app: https://codepen.io/U_B_U/pen/jOBVKKy?editors=100

 

The following is how you set this property.

var view = new MapView({
  container: "viewDiv",
  map: map,
  zoom: 5,
  center: [-107.3567, 37.7705],
  popup: {
    viewModel: {
      featuresPerPage: 1
    }
  }
});

 

-Undral

0 Kudos
ChristopheS
New Contributor II

Hi there, thank you a lot for this.

I will integrate this when 4.20 is available.

Chris.

0 Kudos
UndralBatsukh
Esri Regular Contributor

Hi there, 

It is fixed to 20 features at 4.19. I have created an enhancement request for this to be able to adjust this number. I will update you when this is installed. 

 

-Undral