Select to view content in your preferred language

How do I remove the zoom-to action from the default popup?

10193
18
Jump to solution
03-10-2016 09:23 AM
MarkL
by
Occasional Contributor

How do I remove the zoom-to action from the default popup?  Do I have to manually remove it from the actions array via splice?

Thanks in advance,

M

Tags (1)
1 Solution

Accepted Solutions
SteveCole
Honored Contributor

Just add this to your project's CSS:

.zoomTo {
display:none;
}

It will hide the Zoom To link.

Steve

View solution in original post

18 Replies
SteveCole
Honored Contributor

Just add this to your project's CSS:

.zoomTo {
display:none;
}

It will hide the Zoom To link.

Steve

MarkL
by
Occasional Contributor

Thanks.  Nothing like a little CSS to clean things up.

RobWaller
Occasional Contributor

You can also do it in code by clearing the popup actions, this works for me:

  view.popup.viewModel.actions = [];

KristianEkenes
Esri Regular Contributor

Steve/Mark,

In 4.0 final Popup actions will be a collection of Accessor objects, which has a visible property. So rather than use CSS you can set this property to false:

// hides zoomTo action from popup

view.popup.viewModel.actions.getItemAt(0).visible = false;

This will also make it convenient to show/hide actions based on other logic or attribute values.

JohnRitsko
Deactivated User

This is what I used:

.esriPopup .actionsPane .zoomTo {

display: none;

}

0 Kudos
Aytunc
by
New Contributor

Except for the simple solution I explained below, unfortunately none of the solutions I've found online worked for me to remove the "Zoom To" option from the default popup.

Solution: You simply need to remove the "Zoom To" action from the "actions" array. Emptying the array worked for me since I haven't added any additional actions to this array (by default, the array only contains one action: "Zoom To")

In JavaScript, there are many different ways to delete all elements of an array. What I personally did was:

 

view.popup.actions = [];

 

Above, "view" denotes the SceneView instance I created. This "view" instance might have a different name (and not necessarily has to be a SceneView) in your code but the rest should be the same...

Tip: you can always check the contents of your "actions" array by logging its contents in the console using:

 

var count=0;
view.popup.actions.forEach(element => {
console.log("Item " + count + " : " + element.id );
count++;
});

 

For more details, click here to check out the official documentation of actions in popup.

Tags (2)
GregoryBologna
Frequent Contributor

You can remove all default actions

// Removes the default actions from the popup

view.popup.viewModel.includeDefaultActions = false;

 

includeDefaultActions 

lochd
by
Emerging Contributor

Only this solution works for me after a lot of tries. Thanks!

AbhinavGarg
New Contributor

same here

0 Kudos