Select to view content in your preferred language

Dojo Dropdown Button Questions

3193
2
Jump to solution
08-14-2012 11:27 AM
JoshJones1
Deactivated User
I am using several dojo dijit dropdown buttons for different purposes.  At any point when the page is loading, the buttons will load before the rest of the page, and when they do this they remain open until the page finishes loading.  For some of the buttons this isn't a problem.  But for others, particularly those that contain images, it looks very ridiculous to have a large static image taking up a quqarter of the page, only to again disappear when the page has finished loading.  Is there any way to optimize the buttons to prevent this from happening.


Also, particularly with the Bookmark Widget dropdown, is there any way to have the window close once a bookmark has been selected?


Thanks for the help.


-Josh
0 Kudos
1 Solution

Accepted Solutions
JohnGravois
Deactivated User
i'm not sure how you can correct the display behavior onLoad, but regarding your second question:

since the bookmark widget has an 'onClick' event, we can use it to wire up a function which will query to find the dropdown button and call closeDropDown() to close the popup.

dojo.connect(bookmarks, 'onClick', function(evt) {         dojo.query('.dijitDropDownButton').forEach(function(node,idx){             var btn = dijit.getEnclosingWidget(node);              btn.closeDropDown();         }); });


Here's a fiddle which shows the code at work:
http://jsfiddle.net/jagravois/r6TdX/1/

Class: Bookmarks (Event: onClick)
http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/bookmarks.htm#onClick

View solution in original post

0 Kudos
2 Replies
JohnGravois
Deactivated User
i'm not sure how you can correct the display behavior onLoad, but regarding your second question:

since the bookmark widget has an 'onClick' event, we can use it to wire up a function which will query to find the dropdown button and call closeDropDown() to close the popup.

dojo.connect(bookmarks, 'onClick', function(evt) {         dojo.query('.dijitDropDownButton').forEach(function(node,idx){             var btn = dijit.getEnclosingWidget(node);              btn.closeDropDown();         }); });


Here's a fiddle which shows the code at work:
http://jsfiddle.net/jagravois/r6TdX/1/

Class: Bookmarks (Event: onClick)
http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/bookmarks.htm#onClick
0 Kudos
JoshJones1
Deactivated User
Perfect!


Thank you very much.  Still haven't figured out the onLoad but it is less important than the onClick event.



Thanks again.
0 Kudos