ActionsMenuEnabled does not seem to work

271
4
Jump to solution
04-30-2019 07:02 AM
DarinRodberg
New Contributor

I'm adding an action to my popup, and I've encountered an issue where setting the actionsMenuEnabled to false on my view's popup object doesn't seem to do anything. It still uses the menu instead of just putting the icons across the top.

I initially tried setting the property when configuring the view's popup:

view = new MapView({
	container: "viewDiv",
	map: map,
	center: [-80.2807416961724, 26.9095216535089],
	zoom: 17,
	popup: {
		actionsMenuEnabled: false,
		dockEnabled: true,
		dockOptions: {
			buttonEnabled: false,
			breakpoint: false
		}
	}
});‍‍‍‍‍‍‍‍‍‍‍‍‍‍

But this didn't work: I still had the menu.

I noticed in the only sample code I could find that uses this property (this one) that it is used during a call to view.when(). So then I tried calling view.when() and setting the property there:

view.when(function() {
	var popup = view.popup;
	popup.actionsMenuEnabled = false;
}‍‍‍‍);‍‍‍‍

I also tried:

view.when(function() {
	view.popup.actionsMenuEnabled = false;
}‍‍‍);‍‍‍

And still, no luck. I was wondering if it was to do with the instancing of the view object, but it seems to me like the call to view.when() should handle that.

For what it's worth, here's an example of the action being defined for a particular site:

var actnCAB_1000 = {
	title: "Trace From this Site",
	id: "trace_1",
	image: "/resources/traceicon.png",
};
var site1Template = {
	title: "CAB_1000",
	actions: [actnCAB_1000],
	content: "[a very long string containing html tables goes here]"
};‍‍‍‍‍‍‍‍‍‍

And here's the event handler (which works fine):

view.popup.on("trigger-action", function(event) {
	if (event.action.id.substring(0, 6) === "trace_") {
		window.open("TraceReport?site=".concat(event.action.id.substring(6)));
	}
});‍‍‍‍‍

To answer the question of why I'm defining a new action for each site, it's so I can pass the integer that follows the underscore in the action variable's name to the event handler. There's probably a more elegant way to do that, and I'm all ears if anyone wants to suggest it.

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Esteemed Contributor

Darin,

   And you are using the 4.11 version of the API?

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Esteemed Contributor

Darin,

  So what exactly is not working? You are still getting the menu in the popup?

0 Kudos
DarinRodberg
New Contributor

Yes, it's still giving me the menu option instead of the icons across the top:

0 Kudos
RobertScheitlin__GISP
MVP Esteemed Contributor

Darin,

   And you are using the 4.11 version of the API?

DarinRodberg
New Contributor

I thought I was, but apparently I was still using 4.10. This fixed it, thanks.

0 Kudos