Select to view content in your preferred language

FloorFilter: press "zoom to" button programmaticaly

217
3
10-03-2025 08:01 AM
abru62
by
New Contributor

Hi JavaScript SDK Community,

 

I wrote successfully a MapViewer with a preconfigured (facility, level) FloorFilter. 

The WebMap is shown, the FloorFilter shows the correct facility and the correct floor.

But the WebMap stays at the initial view and zoom. I have to press the "zoom to" button in the FloorFilter to show the selected floor.

 

Is it possible to "press" the FloorFilter zoom button programmaticaly? 

 

Many thanks for any hint.

Regards

Armin

0 Kudos
3 Replies
JoelBennett
MVP Regular Contributor

Yes, you can use the undocumented method "_zoomToClicked" to simulate a click on the "Zoom to" button:

floorFilter._zomToClicked();

 

Note that because this is an undocumented feature, it may be changed or removed in a future version of the SDK without notice.

0 Kudos
abru62
by
New Contributor

Unfortunately it does not work.

Console output is: FloorFilter._zoomToClicked is not a function

 

This is the code (JS SDK 4.33):

const FloorFilter = document.createElement("arcgis-floor-filter");
    FloorFilter.position = "top-left";
    FloorFilter.facility = facility;
    FloorFilter.level = floor;
    FloorFilter.longNames = false;
    viewElement.appendChild(FloorFilter);
    FloorFilter._zoomToClicked();

 

0 Kudos
JoelBennett
MVP Regular Contributor

I see...I thought you were using the widget, but you're actually using the map component.  I'm afraid I don't presently have any further advice in that case.

0 Kudos