Versions Compared

Key

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


Available from v. 1,5,11

...

Info
titleRequirement
  • Android App 1.5.1.1

Description

Excerpt

Show or hide menu items (actions


Page menus are statically created and consist of page-specific and custom menu items.
Data-driven menu items , takes this to another level, where data on a page can control which items are enabled, and which are not, as well as which ones are promoted.

The data can be either orders, order lines or lookup -results.

Functionality

You can control the following on the menu item

  • visible - Shown or hidden
  • promoted - Promoted and the order among promoted items
  • enabled - Selectable or grayed-out

Mobile Configuration 

The configuration needs to be done in two the following places.:

  • On the specific menu item on a given page.
  • On the data send out from the backend.

...


Page Configuration

...

Example

Open and ItemCrossReference menu items are set to be controlled by a data member

Code Block
languagexml
titleExample: Page configuration
linenumberstrue
<page id="Receive" type="OrderList" icon="mainmenureceive">
  <title defaultValue="@{PageReceiveOrderListTitle}" />
  <orderListConfiguration automaticOrderSelectionAfterFilter="true">
    ...
    <list listId="Orders">
      <!-- The enabled attribute is disregarded when the dataMember is setup. -->
      <open enabled="true" *dataMember="showOpenMenu"*/>
     </list>
    ...
  </orderListConfiguration>
  <actions>
    ...
     <open id="ItemCrossReference" dataMember="showCustomMenuItem"/>
     <open id="CreateOrder" dataMember="showCreateOrder" *enabled="OnEmptyListUtilizingDataMember"*/> // Setting the enabled state of the menu item, will display it when  <no data is present.
  </actions>
  <!-- IMPORTANT: If the dataMember property is set on any menu item, defining number of promoted items here will be ignored. -->
  <menu numberOfPromotedItems="1"/>
</page>

...

The configuration needed on each individual data element , consists of a new xml XML element named menuItemStateConfigurations, that which can contain an arbitrary list of elements that sum up the data members available for that given data element.
The element naming is up to the individual implementation , and just needs to match the name set in the dataMember="" attribute on the given menu item.

Valid attributes on the data member elements are as follows.

  • promoted - Promoted and the order among promoted - Dictates that items
  • enabled - Selectable or grayed-out

Visibility

An important note is that if a menu item references a specific data member, and that data member is not present in the data, then the menu item

...

will not be visible.
So the way to control the visibility of a data member-controlled menu item is to have the reference data member included in the data or not.

From version 1.8.1, by setting *enabled="OnEmptyListUtilizingDataMember"* on the menu item it self will enable the data driven menu item when no data is loaded.


A data element could look as follows.

Code Block
languagexml
titleExample: baseOrderLine
linenumberstrue
<baseOrderLine>
  ...
  <menuItemStateConfigurations> <!-- The element containing all menu item configurations. -->
    <showOpenMenu promoted="1" enabled="true"/> <!-- Show the menu item as the first promoted element and enabled. -->
    <showCustomMenuItem promoted="2" enabled="false"/> <!-- Show the menu item as the second promoted item, and make it disabled. -->
  </menuItemStateConfigurations>
</baseOrderLine>


Filter by label (Content by label)
showLabelsfalse
showSpacefalse
sorttitle
reversetrue
titleSee also
excerptTypesimple
excludeCurrenttrue
cqllabel = "numberofpromoteditems"