Select to view content in your preferred language

esri/dijit/Bookmarks Click Event

2199
3
Jump to solution
12-16-2014 09:02 AM
JoeJung
Occasional Contributor

I am working with v.3.11 of the JS API and am having issues with the click event for the Bookmarks‌ Dijit.

Does anyone have any ideas how to return the actual BookmarkItem that was clicked in the bookmark dijit? Currently, the event returns an object that includes the whole bookmark dijit itself, which seems to defeat the purpose of a click event.

Appreciate any help,

Joe

0 Kudos
1 Solution

Accepted Solutions
HeikoHeijenga
Esri Contributor

This is not supported in the publicly exposed API of the Bookmarks widget, you could however use a 'private' function to accomplish what you want. This might break with a new version of the API though, so use with caution.

require(["dojo/aspect", "esri/dijit/Bookmarks"], function(aspect, Bookmarks) {
    ...
    var bookmarkWidget = new Bookmarks(..);
    aspect.after(bookmarkWidget, "_onClickHandler", function(bookmarkItem) {
        // do something with bookmarkItem
    }, true);
    ...
});

View solution in original post

0 Kudos
3 Replies
MahtabAlam1
Frequent Contributor

Hi Joe,

I think it is returning the bookmarkitem ( name and it's extent). Please look Bookmark Widget(Read-only Bookmarks)

Thanks,

Mahtab

0 Kudos
HeikoHeijenga
Esri Contributor

This is not supported in the publicly exposed API of the Bookmarks widget, you could however use a 'private' function to accomplish what you want. This might break with a new version of the API though, so use with caution.

require(["dojo/aspect", "esri/dijit/Bookmarks"], function(aspect, Bookmarks) {
    ...
    var bookmarkWidget = new Bookmarks(..);
    aspect.after(bookmarkWidget, "_onClickHandler", function(bookmarkItem) {
        // do something with bookmarkItem
    }, true);
    ...
});
0 Kudos
JoeJung
Occasional Contributor

This is just what I was looking for.

Thanks for the help!

0 Kudos