Skip to content

Custom Menu Items

1
2
var navbar = AppGiniHelper.getCommon().getNavbar();
navbar.addLink("text", "href", "icon", position);

Parameters


Add Custom Dropdown Menu

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
var navbar = AppGiniHelper.getCommon().getNavbar();

var dropdown = navbar.addDropdown("text", "icon", position);

dropdown.addLink("Text", "url", "icon");

dropdown.addLink("Text", "url", "icon", "target");

dropdown.addButton("Text", function() {
    /* your function */
}, "icon");

Parameters


Add Divider

1
dropdown.addDivider();
1
dropdown.addDivider("text");

Change Icon after creation

If, on creation of a dropdown-menu, you have assigned the return value of addDropdown to a variable, you can use that for changing icon/text later:

1
2
// change menu text/icon later (after creation)
dropdown.set("icon", "Text");

Example

1
2
3
4
5
6
7
8
var navbar = AppGiniHelper.getCommon().getNavbar();
var dropdown_current_user = navbar.addDropdown("...", "user", NavPosition.Right);

// lazy load current user and 
// change text of user-dropdown menu
AppGiniHelper.getMemberID(function(memberID) {
    dropdown_current_user.set("user", memberID);
});

See also