Hi,
I have implemented the application as demonstrated in the Design Studio tutorial for bookmarks.
http://scn.sap.com/docs/DOC-55515
I contains lots of buttons with "On Click" events. In the example you can enter a bookmark name in an input field and save it in a dropdown menu with the button "Save Bookmark". You can then select the bookmark from the dropdown menu (that's the box with the B) and then click on the button "Load Bookmarks".
It would of course be much neater if selecting the bookmark in the dropdown menu would automatically load the bookmark.
I used the dropdown menu event "On Select" and assigned the following script. This is the same that is assigned to the Load Bookmarks button.
//The first line of code loads the bookmark with the value selected from the dropdown menu
Bookmark.loadBookmark(BOOKMARK_DROPDOWN.getSelectedValue());
//The rest of the code populates the dropdown menu and clears the value of the input field.
/* get all Bookmarks */
var bookmarks = Bookmark.getAllBookmarks();
BOOKMARK_DROPDOWN.removeAllItems();
bookmarks.forEach(function(element, index)
{
BOOKMARK_DROPDOWN.addItem(element.name, element.text);
});
Now something that I don't understand at all happens. I can load any bookmark I have created from the dropdown menu
except for the very first bookmark. It doesn't matter if I create 3 or 10 bookmarks, selecting the first bookmark from the dropdown has no effect.
BUT, I can still load that first bookmark using the "Load Bookmarks" button. The script is identical for both components.
Can anyone help me?
Cheers,
Martin
PS The dropdown menu has a little black triangle on the right hand side. I thought that clicking on it would open the dropdown. Actually, you have to click a few millimeters to left. Strange!