Select to view content in your preferred language

Bookmark Widget Customization

5720
9
Jump to solution
07-21-2014 10:33 AM
EricPollard2
Deactivated User

I am trying to make a few changes to the bookmark widget after I've downloaded from the web app builder.

I am trying to take away the add/delete functionality so it is just a static list of bookmarks, but after trying to remove the /div sections the "zoom to" functionality upon clicking no longer works? Is there a better way to do this?

Also, any idea on how to make a specific popup open on the bookmark click? In other words, the bookmark will zoom to center on a specific point as normal, but I also need the popup for that point to automatically open after that bookmark is clicked?

I am new to app development so I am trying to struggle through learning via this project. Thank you for any help !!

Eric

1 Solution

Accepted Solutions
LucasDorrough
Deactivated User

You have to modify the JavaScript too, When you remove the buttons a connection to JavaScript variables is broken, So then the program is trying to access an undefined variable. Removing all "this._switchDeleteBtn();" and "this._switchAddBtn();" will fix your problem. Chromes JavaScript Console can help a lot with debuging these problems, If you have anymore questions I have the modified bookmark code.

View solution in original post

0 Kudos
9 Replies
LucasDorrough
Deactivated User

You have to modify the JavaScript too, When you remove the buttons a connection to JavaScript variables is broken, So then the program is trying to access an undefined variable. Removing all "this._switchDeleteBtn();" and "this._switchAddBtn();" will fix your problem. Chromes JavaScript Console can help a lot with debuging these problems, If you have anymore questions I have the modified bookmark code.

0 Kudos
EricPollard2
Deactivated User

Thanks Lucas ! I am attempting to modify the widget.html and widget.js to accomplish this. I think I was able to figure it out with your instructions! Really appreciate it. Only odd behavior is that the very first time you click one of the bookmark widgets its completely blank, but every time after that the panel populates with bookmarks? www.mysitemarker.com/SiteMarker/shopsatyale.com

Also, any ideas on how to include an onclick function that opens a specific popup using this bookmark panel as described above??  Last piece to get my app looking like it should! Thanks again -Eric

0 Kudos
LucasDorrough
Deactivated User

Propobly want to use the Popup widget built into esri javascript API  Popup widget | ArcGIS API for JavaScript

_onBookmarkClick: is the function that you can put this in

Use show(location, options?) to make the popup appear

0 Kudos
EricPollard2
Deactivated User

Thanks I will be trying to figure out how to add this into the bookmark widget!!

Also, I copied your code but I seem to still have the issue where the very first time you click the bookmarks after you open the app it loads a blank panel, but then every time you click on the bookmark widget after the first time the bookmarks load properly. Any idea why that would be the case?

Thanks again for the help!

Eric

0 Kudos
LucasDorrough
Deactivated User

So first off there is a string of code giving an error that is not even used so remove this starting at line 87

"this.own(on(this.bookmarkName, 'keydown', lang.hitch(this, function(evt){

        var keyNum = evt.keyCode !== undefined ? evt.keyCode : evt.which;

        if (keyNum === 13) {

        }

      })));"

As far as the not appearing the first time, remove this line from the HTML, it will fix it

<div class="jimu-state-error" data-dojo-attach-point="errorNode"> </div>

This is the error message that would appear if the bookmark name was blank when trying to add a new one

EricPollard2
Deactivated User

Perfect !! It's loading on the first click now. Thanks again!!

Only fixes left are the ability for the onCLick event in bookmarks widget to also open a specific popup, and to just get the bookmark panel to close/destroy after one bookmark is clicked (otherwise the panel continues to cover the whole map after selecting a bookmark on mobile devices).

Lucas - Do you do javascript/web development for a living?

0 Kudos
EricPollard2
Deactivated User

So I'm understanding where the onBookmarkClick section is in the js, and I'm adding the popup.show() at the end, it seems like the first thing I need is the point, or coordinates, for each bookmark that I click on. These are stored in the bookmarks JSON config file, so I guess I'm stuck at figuring out how to call up the x,y from the selected bookmark's JSON....

0 Kudos
LucasDorrough
Deactivated User

eh, I have a temporary job in javascript/web sevelopment, so not yet really.

you could also do map.extent.getCenter()  that would return a point (and be pretty easy because all the bookmarks are just map extents). but you would need to make sure that the store/resturant was dead in the center of the screen

I know the geocoder widget has nice popups when you search for something, it uses map.infowindow , its near the bottom of it's code if you wanted to look at that.

0 Kudos
PhilBeilin1
Regular Contributor

Hello! I realize that this post is almost 3 years old now and many not get a reply - but it's worth a try.

Were you ever able to get your bookmarks to open up the specific popup? 

I strongly need this functionality.

If you were able to figure this out could you share some code as to how you did it? 

It would be greatly appreciated.

Thank you.

0 Kudos