require(["esri/dijit/Bookmarks"], function(Bookmarks) { /* code goes here */ });
Description
(Added at v2.5)
The Bookmarks widget is a ready to use tool for bookmarking the current map extent. The widget provides a user interface that allows users to add, remove and edit bookmarks.
Samples
Search for
samples that use this class.
Constructors
CSS
esri/dijit/Bookmarks | Download source
esriAddBookmark | Define the styles for the add bookmark link. |
esriBookmarkEditBox | Define the styles for the edit input box. |
esriBookmarkEditImage | Specify the icon for the edit bookmark image. |
esriBookmarkHighlight | Define the background color and image of the highlighted bookmark. The highlight appears on mouse over. |
esriBookmarkItem | Define the style for the bookmark items. |
esriBookmarkLabel | Define the bookmark label font. |
esriBookmarkRemoveImage | Specify the icon for the remove bookmark image. |
esriBookmarkTable | Define the style of the table that contains bookmark items. |
esriBookmarks | Define the size and border properties for the Bookmark widget. |
Properties
Methods
Events
[ On Style Events | Connect Style Event ]
All On Style event listeners receive a single event object. Additionally, the event object also contains a 'target' property whose value is the object which fired the event.
Events
click | | Fired when a bookmark item is clicked. |
edit | | Fired after the bookmark item is edited. |
remove | | Fired when a bookmark item is removed. |
Old Events
onClick() | Fired when a bookmark item is clicked. |
onEdit() | Fired after the bookmark item is edited. |
onRemove() | Fired when a bookmark item is removed. |
Constructor Details
Creates a new Bookmark widget
Parameters:
<Object > params |
Required |
See options list for parameters. |
<Node | String > srcNodeRef |
Required |
HTML element where the bookmark widget should be rendered. |
params
properties:
<BookmarkItem[] > bookmarks |
Optional |
An array of BookmarkItem objects or a json object with the BookmarkItem format to initially display in the bookmark widget. |
<Boolean > editable |
Optional |
When true, users can add, remove and edit bookmark items. The default value is false. |
<Map > map |
Required |
Reference to the map. The map parameter is required. |
Sample:
require([
"esri/map", "esri/dijit/Bookmarks", "dojo/dom", ...
], function(Map, Bookmarks, dom, ... ) {
var map = new Map( ... );
var bookmarks = new Bookmarks({
map: map,
bookmarks: bookmarks
}, dom.byId('bookmarks'));
...
});
Property Details
An array of BookmarkItem
objects.
Method Details
Add a new bookmark to the bookmark widget. The bookmark can be a BookmarkItem or a json object with the same format.
Parameters:
<BookmarkItem > bookmarkItem |
Required |
A BookmarkItem or json object with the same structure that defines the new location. |
Sample:
require([
"esri/dijit/BookmarkItem", ...
], function(BookmarkItem, ... ) {
var bookmarkItem = new BookmarkItem({
"extent": {
"xmin": -13103005,
"ymin": 3846162,
"xmax": -12933468,
"ymax": 3908687,
"spatialReference": {
"wkid": 102100
}
},
"name": "San Diego"
});
...
});
Destroy the bookmark widget. Call this method when the bookmark widget is no longer needed by the application.
Hides the Bookmark widget.
Remove a bookmark from the bookmark widget.
Parameters:
<String > bookmarkName |
Required |
The name of the bookmark to remove from the bookmark widget. |
Sample:
bookmarks.removeBookmark('Central Pennsylvania');
Show the Bookmark widget.
Finalizes the creation of the widget. (Added at v3.12)
Returns an array of json objects with the following structure:
[{
name:bookmarkName,
extent:bookmarkExtent
}]
Event Details
[ On Style Events | Connect Style Event ]
Fired when a bookmark item is clicked. (Added at v3.6)
Fired after the bookmark item is edited. (Added at v3.6)
Fired when a bookmark item is removed. (Added at v3.6)
Fired when a bookmark item is clicked.
Fired after the bookmark item is edited.
Fired when a bookmark item is removed.