Hide Table of Contents
esri/dijit/util
esri/layer/pixelFilters
esri/process
esri/support
esri/workers
Class: Bookmarks

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

NameSummary
new Bookmarks(params, srcNodeRef)Creates a new Bookmark widget.

CSS

esri/dijit/Bookmarks | Download source

NameDescription
esriAddBookmarkDefine the styles for the add bookmark link.
esriBookmarkEditBoxDefine the styles for the edit input box.
esriBookmarkEditImageSpecify the icon for the edit bookmark image.
esriBookmarkHighlightDefine the background color and image of the highlighted bookmark. The highlight appears on mouse over.
esriBookmarkItemDefine the style for the bookmark items.
esriBookmarkLabelDefine the bookmark label font.
esriBookmarkRemoveImageSpecify the icon for the remove bookmark image.
esriBookmarkTableDefine the style of the table that contains bookmark items.
esriBookmarksDefine the size and border properties for the Bookmark widget.

Properties

NameTypeSummary
bookmarksBookmarkItem[]An array of BookmarkItem objects.

Methods

NameReturn typeSummary
addBookmark(bookmarkItem)NoneAdd a new bookmark to the bookmark widget.
destroy()NoneDestroy the bookmark widget.
hide()NoneHides the Bookmark widget.
removeBookmark(bookmarkName)NoneRemove a bookmark from the bookmark widget.
show()NoneShow the Bookmark widget.
startup()NoneFinalizes the creation of the widget.
toJson()ObjectReturns an array of json objects with the following structure:

[{

  name:bookmarkName,

  extent:bookmarkExtent

}]

.

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

NameEvent ObjectSummary
clickFired when a bookmark item is clicked.
editFired after the bookmark item is edited.
removeFired when a bookmark item is removed.
Constructor Details

new Bookmarks(params, srcNodeRef)

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

<BookmarkItem[]> bookmarks

An array of BookmarkItem objects.
Method Details

addBookmark(bookmarkItem)

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()

Destroy the bookmark widget. Call this method when the bookmark widget is no longer needed by the application.

hide()

Hides the Bookmark widget.

removeBookmark(bookmarkName)

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()

Show the Bookmark widget.

startup()

Finalizes the creation of the widget. (Added at v3.12)

toJson()

Returns an array of json objects with the following structure:

[{

  name:bookmarkName,

  extent:bookmarkExtent

}]

Return type: Object
Event Details
[ On Style Events | Connect Style Event ]

click

Fired when a bookmark item is clicked. (Added at v3.6)

edit

Fired after the bookmark item is edited. (Added at v3.6)

remove

Fired when a bookmark item is removed. (Added at v3.6)
Show Modal