Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This walk through will show you to add your own custom menu items to menu located on the right side.

Table of Contents

Setting up a Function

To add a new menu item to the main menu on the right side, first navigate to the "Funcs" app.

Image Removed 

Click on the "New" button located in the upper left corner. 

Image Removed

Name your function and click "Ok".

Image Removed

Select the new function from the list of functions on the left hand side, if it is not already selected, and click on the "Edit" button located above the body of the function.

Image Removed

In the pop window, click on the "Add Tags" button to add a new tag.

Image Removed

Type in "finStackMobileMenu" and click the "Add" button. This is how the menu on the right side will know to include this function.

 Image Removed

Finally, click on the "Ok" button to save these changes. 

Image Removed

Creating the Menu Item

Inside the function that was just created, you will want to return a list of dictionaries. Each dictionary will become a menu item. For this example we will create a single, simple menu item that will open a simple form and our list will look like this:

Code Block
languagejs
firstline1
[
  {
    displayName: "My Menu Item", 
    appId: "myMenu", 
    icon: "icon-trophy", 
    iconType: "class", 
    level: 0, 
    ui: "mobile",
    order: 5, 
    action: "finstack.eval('finFormAlertOk(\"My Menu Item\", \"This is called from my brand new menu item!\")')", 
    keepOpen: true
  }
]

First, every menu item must have "displayName" and "appId" string properties. All other properties are optional:

  • displayName - (str) This is the text that will appear in the menu item.
  • appId - (str) This is mainly used when traversing menus and highlighting purposes.
  • icon: (str) This will be the icon that appears to the left of the displayName. A full icon list can be found by going to your_host:your_port/pod/finStackMobileExt/icons.html. (For example:localhost:85/pod/finStackMobileExt/icons.html)
  • iconType: (str) This is used to determine the type of icon. When using icons from the provided list, it will always be "class".
  • level: (integer) This determines the level of indentation of the icon and displayName for a tree-like effect. Defaults to 0 if not present.
  • order: (integer) This determines the order in which the menu-items will appear. Items are sorted by this property first and then alphabetically by the displayName. Defaults to 99 if not present.
  • action: (str) This is used to define what javascript action will happen when the menu items are clicked. In this case it will open a form using finstack.eval.
  • keepOpen: (bool) This will keep the right-side menu open after a user has clicked on this menu-item. Defaults to false if not present.

A full list of menu item properties and more detailed explanations can be found here: Menu Properties

The function should look like this in the end:

Code Block
languagejs
themeMidnight
firstline1
titleComplete sampleMenuItem function
linenumberstrue
collapsetrue
() => do
  [
    {
      displayName: "My Menu Item", 
      appId: "myMenu", 
      icon: "icon-trophy", 
      iconType: "class", 
      level: 0, 
      ui: "mobile",
      order: 5, 
      action: "finstack.eval('finFormAlertOk(\"My Menu Item\", \"This is called from my brand new menu item!\")')", 
      keepOpen: true
    }
  ]
end

The menu item should now appear in the main menu:

Image Removed