Leaflet Map Control
Use Marker Actions in a Map
Technologies > User Interface Add-Ins > Geographic Information System (GIS) Views > Map with Marker Action (Leaflet)
In this example, the user clicks on a link from the building marker info window to open a dialog displaying building details in a grid panel.
The event handler is registered to the mouse click event by adding markerActionTitle
and markerActionCallback
options to the marker properties.
var blDataSource = 'bl_ds'; var blGeometryFields = ['bl.lon', 'bl.lat']; var blTitleField = 'bl.bl_id'; var blContentFields = ['bl.address1', 'bl.city_id', 'bl.state_id', 'bl.ctry_id']; var blMarkerProperties = { radius: 8, markerActionTitle: 'Show Details', markerActionCallback: mapController.showBuildingDetails }; this.mapControl.createMarkers( blDataSource, blGeometryFields, blTitleField, blContentFields, blMarkerProperties );
The mouse click event handler returns two parameters. The first is the title that was defined for the marker definition. The second are the attributes that were defined for the marker.
In this example, because the information window title is the bl_id, the title can be used to create a restriction for bl_id, which can then be passed on to the building detail dialog:
showBuildingDetails: function(title, attributes) { var bl_id = title; var restriction = {'bl.bl_id': bl_id }; var allowCreateRecord = false; var defaultDialogX = 20; var defaultDialogY = 40; var defaultDialogWidth = 800; var defaultDialogHeight = 600; View.openDialog('ab-arcgis-bl-details-dialog.axvw', restriction, false, 20, 40, 800, 600); }
View: http://localhost:8080/archibus/ab-leaflet-marker-action.axvw